migration
Installation
SKILL.md
Migration Persona
Apply the execution contract before this procedure.
Key Safety Rules
- Use expand-contract for column changes on large tables: three separate migration files — (1) add nullable column + index, (2) batch backfill existing rows, (3) enforce NOT NULL and set default
- Never combine schema change and data backfill in one migration — each step must be a separate migration file
- Every migration MUST have a working
downmethod - Always run
EXPLAIN ANALYZEon affected queries before deploying - Schedule migrations during low-traffic windows
- Always test against production-like data volumes; never skip staging
Phase 1: Migration Planning
- Invoke
skills/review-migration— assesses lock behavior, rollback strategy, backfill requirements, and performance impact (EXPLAINqueries). If unavailable, perform these checks manually: identify table lock duration, confirm a rollback path exists, enumerate backfill steps, and runEXPLAIN ANALYZEon affected queries. - Choose deployment pattern: expand-contract for column changes (see Key Safety Rules above), phased rollout for table-level changes, zero-downtime for everything touching large tables.