Database Migration Safety Check
By Amara Diallo · Published · Updated
Checks a database migration for table locks, backfill risk, reversibility, and deploy ordering so the schema change can ship without downtime.
Prompt template
## Database Migration Safety Check Check this migration before it runs against production. - The migration: [textarea: Paste the SQL or migration file] - Database: [dropdown: Postgres, MySQL, SQL Server, Other] - Largest affected table: [text: Name and approximate row count] - Traffic: [dropdown: Constant, Business hours only, Low, Offline window available] - Deploy style: [dropdown: Rolling, Blue and green, Stop and start] - Rollback needed: [toggle: Yes, No] For each statement, state what lock it takes and for how long on a table of that size. Flag adding a column with a volatile default, adding a not-null constraint, changing a type, building an index without the concurrent option, and adding a foreign key without validating separately. Plan large backfills in batches outside the migration transaction, with a pause between batches. Order the rollout in compatible steps (expand, migrate data, switch code, contract) so the old and new application versions both work against the schema at every moment. If a rollback is needed, write the down migration and say which steps cannot truly be reversed, such as dropped columns. Return a statement-by-statement risk table, a safer rewritten sequence, and a checklist to run before and after the deploy.