Database Migration Rollback Plan Builder
Generate a safe database migration plan with rollout steps, rollback procedures, validation checks, and communication notes for production changes.
Prompt Template
You are a senior platform engineer responsible for production database changes. Build a migration and rollback runbook for the following change. Database: [PostgreSQL / MySQL / etc.] Application stack: [framework and deployment setup] Current schema/context: [relevant tables, traffic patterns, scale] Planned change: [column add, backfill, rename, table split, index change, etc.] Risk level: [low / medium / high] Downtime tolerance: [none / short maintenance window / flexible] Dependencies: [application deploys, feature flags, ETL jobs, replicas, analytics] Provide: 1. **Pre-migration checklist** — backups, capacity checks, communication, dry runs 2. **Migration strategy** — exact rollout order with reasoning 3. **Validation steps** — what to verify before, during, and after deploy 4. **Rollback plan** — exact triggers, steps, and decision points 5. **Monitoring plan** — errors, latency, locks, replication lag, data drift 6. **Communication template** — update for engineers and stakeholders 7. **Post-mortem prompts** — questions to answer if anything goes wrong Assume the audience is an engineering team running this in production. Prefer safe phased rollouts, backwards-compatible changes, and feature-flagged cutovers where appropriate.
Example Output
Migration Strategy
1. Add nullable `status_v2` column without changing reads
2. Deploy app version that dual-writes to `status` and `status_v2`
3. Backfill historical rows in batches of 5,000 with lock monitoring
4. Validate parity on 100% of rows
5. Flip reads behind feature flag for 5% of traffic, then 50%, then 100%
6. Remove dual-write only after parity holds for 24 hours
Rollback Trigger
If write latency increases by 30% for 10 minutes or parity drops below 99.9%, disable the read flag and revert app deploy before touching schema.
Monitoring
- replication lag
- deadlocks
- slow query logs
- row parity dashboard
- error rate on write path
Tips for Best Results
- 💡Include whether the migration is additive, destructive, or a rename because the safest rollout pattern changes a lot by type.
- 💡Mention your deployment topology, a monolith, worker fleet, and analytics jobs often need different sequencing.
- 💡Ask the AI to produce SQL snippets only after you have a sound operational plan.
- 💡Always request explicit rollback triggers, not just rollback steps.
Related Prompts
Code Review Assistant
Get a thorough, senior-level code review with actionable feedback on quality, security, performance, and best practices.
Debugging Detective
Systematically debug errors and unexpected behavior with root cause analysis and fix suggestions.
Code Refactoring Advisor
Transform messy, complex code into clean, maintainable, well-structured code with clear explanations.