Skip to content

Commit ecde1da

Browse files
committed
a fix on search path for the base migration script
1 parent cd72089 commit ecde1da

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

source/guides/postgres-migration.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ Once we set the schema to a desired state, we can start migrating the **data** b
157157
$$ UPDATE {{ .source_schema }}.db_migrations set name='add_createat_to_teamembers' where version=92; $$,
158158
$$ CREATE INDEX IF NOT EXISTS idx_posts_message_txt ON {{ .source_schema }}.posts USING gin(to_tsvector('english', message)); $$,
159159
$$ CREATE INDEX IF NOT EXISTS idx_fileinfo_content_txt ON {{ .source_schema }}.fileinfo USING gin(to_tsvector('english', content)); $$,
160-
$$ ALTER SCHEMA {{ .source_schema }} RENAME TO public; $$;
160+
$$ ALTER SCHEMA {{ .source_schema }} RENAME TO public; $$,
161+
$$ SELECT pg_catalog.set_config('search_path', '"$user", public', false); $$,
162+
$$ ALTER USER {{ .pg_user }} SET SEARCH_PATH TO 'public'; $$;
161163
162164
Once you save this configuration file, e.g. ``migration.load``, you can run the ``pgLoader`` with the following command:
163165

@@ -301,7 +303,7 @@ Once we are ready to migrate, we can start migrating the **schema** and the **da
301303
$$ CREATE INDEX IF NOT EXISTS ir_playbookmember_playbookid on {{ .source_schema }}.IR_PlaybookMember(PlaybookId); $$,
302304
$$ ALTER SCHEMA {{ .source_schema }} RENAME TO public; $$,
303305
$$ SELECT pg_catalog.set_config('search_path', '"$user", public', false); $$,
304-
$$ ALTER USER mmuser SET SEARCH_PATH TO 'public'; $$;
306+
$$ ALTER USER {{ .pg_user }} SET SEARCH_PATH TO 'public'; $$;
305307
306308
.. code:: bash
307309
@@ -358,7 +360,7 @@ Once we are ready to migrate, we can start migrating the **schema** and the **da
358360
$$ UPDATE {{ .source_schema }}.focalboard_users SET `props` = "{}" WHERE `fields` = ""; $$,
359361
$$ ALTER SCHEMA {{ .source_schema }} RENAME TO public; $$,
360362
$$ SELECT pg_catalog.set_config('search_path', '"$user", public', false); $$,
361-
$$ ALTER USER mmuser SET SEARCH_PATH TO 'public'; $$;
363+
$$ ALTER USER {{ .pg_user }} SET SEARCH_PATH TO 'public'; $$;
362364
363365
.. code:: bash
364366

0 commit comments

Comments
 (0)