Database migrations are risky. This checklist minimizes the risk.
Planning¶
- ☐ Migration tested on copy of production data
- ☐ Execution time estimate
- ☐ Rollback script prepared
- ☐ Maintenance window planned (if needed)
- ☐ Stakeholders informed
Zero-Downtime Techniques¶
- ☐ Expand-contract pattern
- ☐ New column with default value (not NOT NULL without default)
- ☐ Index CONCURRENTLY (PostgreSQL)
- ☐ Backfill in batches, not all at once
- ☐ Dual-write pattern for large refactors
Safety¶
- ☐ Backup before migration
- ☐ Point-in-time recovery functional
- ☐ Migration idempotent
- ☐ Rollback tested
Post-Migration¶
- ☐ Verify data integrity
- ☐ Check query performance
- ☐ Old columns/tables deleted (with delay)
- ☐ Monitoring OK
Rule¶
Never migrate on Friday afternoon. And always have a rollback plan.
databasemigrationdevops