Skip to content

[Pg]: pin search_path to public during migrate#6024

Open
Otto-Deviant1904 wants to merge 1 commit into
drizzle-team:betafrom
Otto-Deviant1904:fix/pg-migrate-search-path-public
Open

[Pg]: pin search_path to public during migrate#6024
Otto-Deviant1904 wants to merge 1 commit into
drizzle-team:betafrom
Otto-Deviant1904:fix/pg-migrate-search-path-public

Conversation

@Otto-Deviant1904

Copy link
Copy Markdown

Fixes #5889

When migrations.schema matches the Postgres DB username, CREATE SCHEMA
makes the $user search_path entry resolve. Unqualified CREATE TABLE
statements in migration SQL then land on that schema instead of public,
while snapshots still record public.

Set search_path to public before applying user migration statements
(SET LOCAL inside transactions; plain SET for neon-http / pg-proxy).
Added a node-postgres regression that uses migrationsSchema = current_user.

AI disclosure: assisted with investigation and the patch. I reviewed the
change and verified the approach against the issue's root-cause writeup.

Made with Cursor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant