Skip to content

fix(db): deterministic per-file search_path in migration runner - #112

Merged
iamjr15 merged 1 commit into
mainfrom
fix/migration-search-path
Aug 2, 2026
Merged

fix(db): deterministic per-file search_path in migration runner#112
iamjr15 merged 1 commit into
mainfrom
fix/migration-search-path

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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 unqualified v2_entitlements reference 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_catalog at 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
  • Post-merge: wizard resume on the half-migrated fresh project (0000 ledgered, 0001-0003 pending) must complete 0001→0003 + target assertion — the exact failed scenario.

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.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cheatcode Skipped Skipped Aug 2, 2026 8:20am

@iamjr15
iamjr15 merged commit 7bd5524 into main Aug 2, 2026
6 checks passed
@iamjr15
iamjr15 deleted the fix/migration-search-path branch August 2, 2026 08:21
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