deploy-migration
Deploy a migration
Production is migrated by hand, by Matt (ADR 0026). apps/remote deploys on every merge, and its build (apps/remote/scripts/assert-migrations-applied.mjs) fails on purpose when production lacks the commit's latest migration, so the previous deployment keeps serving. You merge, Matt migrates, then you redeploy.
You never run pnpm db:migrate against production, and you never write to production by any other route either. packages/core/drizzle-guard.ts refuses most wrong runs, but don't rely on it.
1. Generate and merge
- Change
packages/core/db/schema.ts, then runpnpm db:generate. Commit the generated SQL and themeta/files unedited. - The migration and the code that uses it may ship in one PR. It must be additive: a new table, a nullable column, or a column with a default. For anything destructive, see section 4.
- Land it the usual way (
docs/agents/merging.md).
2. The deploy fails, and Matt migrates
The apps/remote deploy for the merge commit fails with production has not applied <tag>. That failure is expected and harmless: the old deployment is still serving.
Send Matt exactly one message with the migration tag and this command, run from his main checkout: