P
AdvancedClaude

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

Adapt this prompt

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:

  1. Expand phase: backward-compatible changes (SQL scripts)
  2. Code migration phase: application deployment
  3. Contract phase: cleanup of old elements

For each phase:

  • Exact SQL to run
  • Pre- and post-checks
  • Estimated duration and performance impact
  • Rollback procedure
  1. Monitoring: metrics to watch during the migration
  2. Full rollback plan if the migration fails
  3. 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

Renaming a column in productionAdding a NOT NULL constraint on a large tablePartitioning a rapidly growing table

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 Optimizer

Comments

Be the first to comment on this prompt.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further