BE-DP-12 · Before the merge: the migration machinery's tests, then the regenerated types
ID BE-DP-12 · Level L0 · Pack Pack R4 · The migration machinery · Run order row 4, first: before the pull request for #186 is merged · Issue #186
On the pull request's branch, every pgTAP test passes on your Mac's local stack, the machinery's 25 included, and packages/db-types holds the types generated from its schema. The pack adds migrated to audit_action and three keys to error_key, so the types change (D33). The Backend Engineer's workspace can't run the Supabase stack, so pnpm db:types is yours to run; the types are never written by hand (D22).
Before
Section titled “Before”- The pull request for #186 is open on the branch
be/186-migration-machinery, with DOC's R-MIG rules on it. Its database job fails on "The generated files match the schema" until this step's commit lands; every other check is green. - You are at the root of your clone, the local stack is running, and
git status --shortprints nothing.
1 · The branch, rebuilt from nothing, and every test
Section titled “1 · The branch, rebuilt from nothing, and every test”git fetch origin be/186-migration-machinerygit switch be/186-migration-machinerypnpm supabase db resetpnpm supabase test db2 · The types and the reference pages from this schema
Section titled “2 · The types and the reference pages from this schema”pnpm db:typespnpm docs:referencegit status --short3 · apps/web still typechecks
Section titled “3 · apps/web still typechecks”pnpm typecheck4 · Commit the generated files and push them to the branch
Section titled “4 · Commit the generated files and push them to the branch”git add packages/db-types apps/docs/src/content/docs/referencegit commit -m "build(db-types): regenerate for the migration machinery (D33)"git pushExpect
Section titled “Expect”- Block 1: "Finished supabase db reset", then
All tests successful.andResult: PASS. The machinery's tests are the 25 in44_migration.test.sql, whose descriptions startR-MIG-01toR-MIG-08,R-AUD-15andR-AUD-16. - Block 2:
M packages/db-types/src/database.ts:audit_actiongainsmigrated, anderror_keygainsmigration.no_open_run,migration.unknown_stepandmigration.unmapped_values. The reference pages were generated in the pull request from the same schema, so they shouldn't change; if one does, it goes into the same commit. - Block 3: no error. The change only adds enum values.
- Block 4: ✔️ biome and ✔️ commitlint, then the push. The pull request's checks turn green.
gh pr checks be/186-migration-machineryEvery check passes, the database job included.
If it fails
Section titled “If it fails”- A test fails in block 1: paste the
not okline and the lines under it starting with#into #186, and don't merge. - Block 3 fails: paste the errors into the pull request. Under D33, the Frontend Engineer fixes the named pages on the same branch; an enum that gained a value can make an exhaustive label map fail typecheck until it has a label.
- Block 2 lists something outside packages/db-types and the reference pages: stop, and paste
git status --short.
Before the push: git reset --hard origin/be/186-migration-machinery. After it: tell the Backend Engineer on the pull request, who reverts the commit. Nothing here touches staging or production.
Log each run as a comment on #186: the date, block 1's last lines, block 2's git status --short and the commit's hash.