add-migration
Changes the database schema through a Drizzle migration that runs on PGlite in tests and on Neon only through migrate-on-deploy. Use for any table, column, index or constraint change.
SKILL.md.claude/skills/add-migration/SKILL.md
GitHubAdd a migration
- Edit the Drizzle schema. Prefer additive changes (new nullable column, new table, new index); a destructive change needs the owner's approval first.
- Generate the migration with the project script (
pnpm db:generate, Stage 2) and read the SQL it produced. Never edit an applied migration; add a new one. - Constraints that the API relies on (unique email, foreign keys) live in the database, not only in Zod.
- Run the integration tests on PGlite; they apply every migration from scratch.
- Never run a migration against production by hand. Production applies migrations during the Vercel production build only (migrate-on-deploy).
- Note the change in
docs/DECISIONS.mdif it changes the contract, and runcode-reviewerandsecurity-reviewer.