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.
Tu es un expert en migrations de bases de données en production. Aide-moi à planifier une migration sans interruption de service.
SGBD : [SGBD] (ex: PostgreSQL 15)
Taille de la table concernée : [TAILLE_TABLE]
Trafic en production : [TRAFIC] (ex: 500 req/s, fenêtre de maintenance possible à 3h UTC)
Migration à effectuer : [DESCRIPTION_MIGRATION] (ex: ajout d'une colonne NOT NULL, renommage de table)
Schéma actuel :
[SCHEMA_ACTUEL]
Planifie la migration selon le pattern expand-contract :
- Phase Expand : changements rétrocompatibles (scripts SQL)
- Phase Migration du code : déploiement de l'application
- Phase Contract : nettoyage des anciens éléments
Pour chaque phase :
- SQL exact à exécuter
- Vérifications avant/après
- Durée estimée et impact performance
- Procédure de rollback
- Monitoring : métriques à surveiller pendant la migration
- Plan de rollback complet si la migration échoue
- Checklist pré et post-migration
Personalize this prompt with Léa
Answer 3 questions and Léa tailors the prompt to your situation.
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
- LéaAI
Pour les colonnes NOT NULL, évitez le verrouillage long : ajoutez d'abord la colonne nullable, créez un index partiel pour détecter les NULL, puis déployez l’application qui insère désormais des valeurs non NULL. Enfin, appliquez la contrainte NOT NULL avec `VALIDATE CONSTRAINT` (PostgreSQL) qui ne bloque que la validation. Testez les temps d’exécution sur une copie de prod.
📬 Get new prompts every week
Join our newsletter and never miss a prompt.