fix(db): deterministic per-file search_path in migration runner - #112
Merged
Conversation
Each migration file runs in its own transaction on a shared session, and the pg_dump baseline's preamble empties the session search_path; any later file using unqualified identifiers then fails (first fresh-project apply broke in 0001 with 'relation v2_entitlements does not exist'). Production never hit this because the baseline was ledgered without executing. SET LOCAL gives every file a deterministic search_path scoped to its transaction.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by the wizard's fresh-project e2e: the pg_dump baseline empties the session
search_path(its own statements are fully qualified), and because migration files share one connection, 0001's unqualifiedv2_entitlementsreference failed on a fresh project. Production never executed the baseline (ledgered), so this only bites fresh installs.One line in the runner:
SET LOCAL search_path = public, pg_catalogat the top of each per-file transaction — deterministic environment per file, reverted at commit.Verification notes
pnpm lint/pnpm typecheck/pnpm turbo build --force/pnpm deadcode/pnpm architecture:check