From bff2989d95c151a2fdfa9ec9124d6adab3a0f7c2 Mon Sep 17 00:00:00 2001 From: Ibrahim Serdar Acikgoz Date: Wed, 5 Jun 2024 18:53:16 +0200 Subject: [PATCH] Prevent null unicode character errors during the migration (#26974) --- server/tests/template.load | 43 ++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/server/tests/template.load b/server/tests/template.load index e6400e6651..1c542093c5 100644 --- a/server/tests/template.load +++ b/server/tests/template.load @@ -3,35 +3,38 @@ LOAD DATABASE INTO pgsql://{{ .pg_user }}:{{ .pg_password }}@postgres:5432/{{ .target_schema }} WITH data only, - workers = 8, concurrency = 1, - multiple readers per thread, rows per range = 50000, - create no tables, create no indexes, - preserve index names + workers = 8, concurrency = 1, + multiple readers per thread, rows per range = 10000, + prefetch rows = 10000, batch rows = 2500, + create no tables, create no indexes, + preserve index names SET PostgreSQL PARAMETERS - maintenance_work_mem to '128MB', - work_mem to '12MB' + maintenance_work_mem to '128MB', + work_mem to '12MB' SET MySQL PARAMETERS - net_read_timeout = '120', - net_write_timeout = '120' + net_read_timeout = '120', + net_write_timeout = '120' -CAST column Channels.Type to "channel_type" drop typemod, - column Teams.Type to "team_type" drop typemod, - column UploadSessions.Type to "upload_session_type" drop typemod, - column Drafts.Priority to text, - type int when (= precision 11) to integer drop typemod, - type bigint when (= precision 20) to bigint drop typemod, - type text to varchar drop typemod, - type tinyint when (<= precision 4) to boolean using tinyint-to-boolean, - type json to jsonb drop typemod + CAST column Channels.Type to "channel_type" drop typemod, + column Teams.Type to "team_type" drop typemod, + column UploadSessions.Type to "upload_session_type" drop typemod, + column ChannelBookmarks.Type to "channel_bookmark_type" drop typemod, + column Drafts.Priority to text, + type int when (= precision 11) to integer drop typemod, + type bigint when (= precision 20) to bigint drop typemod, + type text to varchar drop typemod using remove-null-characters, + type tinyint when (<= precision 4) to boolean using tinyint-to-boolean, + type json to jsonb drop typemod using remove-null-characters EXCLUDING TABLE NAMES MATCHING ~, ~ BEFORE LOAD DO - $$ ALTER SCHEMA public RENAME TO {{ .source_schema }}; $$, - $$ DROP INDEX IF EXISTS idx_posts_message_txt; $$, - $$ DROP INDEX IF EXISTS idx_fileinfo_content_txt; $$ + $$ ALTER SCHEMA public RENAME TO {{ .source_schema }}; $$, + $$ TRUNCATE TABLE {{ .source_schema }}.systems; $$, + $$ DROP INDEX IF EXISTS {{ .source_schema }}.idx_posts_message_txt; $$, + $$ DROP INDEX IF EXISTS {{ .source_schema }}.idx_fileinfo_content_txt; $$ AFTER LOAD DO $$ UPDATE {{ .source_schema }}.db_migrations set name='add_createat_to_teamembers' where version=92; $$,