1---2name: db-migration-review3description: review database migrations for safety, compatibility windows, backfills, reversibility, and rollout risk. use when migration files, schema diffs, orm model changes, indexes, constraints, or data backfills change.4---56# DB Migration Review78## Trigger Signals910- the task adds or edits migrations, DDL, backfills, seed data, or schema-affecting ORM changes11- the change touches EF Core, Flyway, Liquibase, Prisma, Atlas, handcrafted SQL, or online migration tooling12- rollout safety matters because the database is large, hot, replicated, or shared by multiple services1314## Inspect First1516- migration files, generated SQL, and schema model diffs17- the application code that reads or writes the changed tables or columns18- deployment order, backfill jobs, feature flags, and rollback expectations19- table size, hot paths, index usage, and engine-specific lock sensitivity when evidence exists2021## Workflow22231. classify the change as additive, destructive, rewrite-heavy, data-moving, or operationally sensitive242. determine the compatibility window between old code, new code, and intermediate schema states253. inspect lock, rewrite, replication, and backfill risk with the engine and tool in mind264. verify reversibility, forward-fix options, and post-deploy validation steps275. emit a risk-ranked review with concrete rollout guidance, not generic warnings2829## Output Contract3031- migration summary grouped by schema change, data change, and rollout shape32- risk level with the exact reasons it is safe, risky, or blocked33- expand-and-contract verdict, rollback or forward-fix plan, and validation queries or checks34- follow-up tasks for app changes, monitoring, throttling, or staged deployment3536## Failure Modes3738- engine, table size, or traffic profile is unknown and materially changes risk39- the migration file exists without the surrounding application rollout plan40- generated SQL is unavailable for toolchains that hide the real DDL4142## Escalation4344- escalate when a migration can drop data, rewrite a large table, block hot paths, or break mixed-version application deployments45- escalate when backfills are non-idempotent, unthrottled, or lack checkpointing46- escalate when rollback is impossible and no forward-fix path or validation telemetry exists4748## References4950- `skills/db-migration-review/references/risk-taxonomy.md`51- `skills/db-migration-review/references/expand-contract.md`52- `skills/db-migration-review/references/engine-specific-hotspots.md`53- `skills/db-migration-review/references/tooling-signals.md`54- `skills/db-migration-review/references/rollout-and-backfill.md`55- `skills/db-migration-review/references/review-template.md`56- `skills/db-migration-review/references/examples.md`