AIO APEX
GPT-4Database management

Planificateur de migrations sans temps d'arrêt

Partager:

Why this prompt matters

Schema migrations are the #1 cause of production outages. Planning backward-compatible phases eliminates the 'big bang' migration risk.

What we use it for

Database management

Prompt

Plan a zero-downtime database migration for the described schema change. Include: 1) Step-by-step migration phases, 2) Backward-compatible intermediate states, 3) Data backfill strategy, 4) Rollback plan for each phase, 5) Monitoring queries to verify data integrity, 6) Estimated timeline.

Result

## Migration Plan: Adding `organization_id` to Users

### Phase 1: Add Column (Deploy anytime) ```sql ALTER TABLE users ADD COLUMN organization_id UUID; CREATE INDEX CONCURRENTLY idx_users_org ON users(organization_id); ``` Application continues to work — column is nullable.

### Phase 2: Backfill (Run in batches) ```sql UPDATE users SET organization_id = (SELECT id FROM organizations WHERE ...) WHERE organization_id IS NULL LIMIT 1000; ```

### Phase 3: Make Required (After backfill verified) ```sql ALTER TABLE users ALTER COLUMN organization_id SET NOT NULL; ```

**Rollback**: Each phase is independently reversible.

Planificateur de migrations sans temps d'arrêt

Planifie des migrations de base de données sans interruption de service.

Ce prompt d'IA est conçu pour vous aider à obtenir les meilleurs résultats. Suivez les instructions et personnalisez les paramètres selon vos besoins spécifiques.

Pour obtenir les meilleurs résultats, fournissez un contexte détaillé et spécifiez le format de sortie souhaité. Expérimentez avec différentes variations pour trouver celle qui convient le mieux à votre cas d'utilisation.

Partager: