Plan a Zero-Downtime Database Migration
Plans a production database migration with zero downtime using the expand-contract pattern, with exact SQL, checks, rollback and monitoring.
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
You are an expert in production database migrations. Help me plan a migration with zero downtime.
DBMS: [dbms] (e.g., PostgreSQL 15)
Size of the table involved: [table size]
Production traffic: [traffic] (e.g., 500 req/s, maintenance window possible at 3:00 AM UTC)
Migration to perform: [migration description] (e.g., adding a NOT NULL column, renaming a table)
Current schema:
[current schema]
Plan the migration using the expand-contract pattern:
- Expand phase: backward-compatible changes (SQL scripts)
- Code migration phase: application deployment
- Contract phase: cleanup of old elements
For each phase:
- Exact SQL to run
- Pre- and post-checks
- Estimated duration and performance impact
- Rollback procedure
- Monitoring: metrics to watch during the migration
- Full rollback plan if the migration fails
- Checklist before and after the migration
Personalize this prompt with Léa · AI assistant
Léa rewrites this prompt for your job and your exact goal — 3 quick questions.
Why this prompt works
The expand-contract pattern is the most proven technique for zero-downtime migrations but poorly documented. Requesting rollback for each phase reflects the rigor needed in production. Estimated duration per phase allows planning the migration during low-traffic windows.
Use Cases
Expected Output
A 3-phase plan (expand/migration/contract) with exact SQL, checks, estimated duration, per-phase rollback, monitoring metrics and complete checklist.
Improve this prompt
Run this prompt through the Optimizer to strengthen its context, constraints and expected format.
Improve this prompt with the OptimizerComments
Be the first to comment on this prompt.
Glossary Terms
📬 Get new prompts every week
Join our newsletter and never miss a prompt.