Planer für Migrationen ohne Ausfallzeit
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.
Planer für Migrationen ohne Ausfallzeit
Plant Datenbankmigrationen ohne Serviceunterbrechung.
Dieser KI-Prompt ist darauf ausgelegt, Ihnen die besten Ergebnisse zu liefern. Folgen Sie den Anweisungen und passen Sie die Parameter an Ihre spezifischen Bedürfnisse an.
Für die besten Ergebnisse geben Sie detaillierten Kontext an und spezifizieren Sie das gewünschte Ausgabeformat. Experimentieren Sie mit verschiedenen Variationen, um die beste für Ihren Anwendungsfall zu finden.