Skip to content

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).

  • 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 --short prints nothing.

1 · The branch, rebuilt from nothing, and every test

Section titled “1 · The branch, rebuilt from nothing, and every test”
Terminal window
git fetch origin be/186-migration-machinery
git switch be/186-migration-machinery
pnpm supabase db reset
pnpm supabase test db

2 · The types and the reference pages from this schema

Section titled “2 · The types and the reference pages from this schema”
Terminal window
pnpm db:types
pnpm docs:reference
git status --short
Terminal window
pnpm typecheck

4 · Commit the generated files and push them to the branch

Section titled “4 · Commit the generated files and push them to the branch”
Terminal window
git add packages/db-types apps/docs/src/content/docs/reference
git commit -m "build(db-types): regenerate for the migration machinery (D33)"
git push
  • Block 1: "Finished supabase db reset", then All tests successful. and Result: PASS. The machinery's tests are the 25 in 44_migration.test.sql, whose descriptions start R-MIG-01 to R-MIG-08, R-AUD-15 and R-AUD-16.
  • Block 2: M packages/db-types/src/database.ts: audit_action gains migrated, and error_key gains migration.no_open_run, migration.unknown_step and migration.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.
Terminal window
gh pr checks be/186-migration-machinery

Every check passes, the database job included.

  • A test fails in block 1: paste the not ok line 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.