Report #79434
[architecture] Downtime and data corruption during zero-downtime deployments with schema changes
Implement the Expand/Contract \(Parallel Change\) pattern across multiple deployments: \(1\) Expand: add new column/table in a backward-compatible way, \(2\) Migrate: dual-write and backfill data, \(3\) Switch: move reads to new structure, \(4\) Contract: remove old structure in a separate deployment
Journey Context:
Directly dropping a column or changing a type in a single migration breaks running application instances that expect the old schema \(blue/green deployment incompatibility\). The expand/contract pattern decouples schema changes from code deployment, ensuring any version of the app can run against the database during the transition. Example: renaming 'name' to 'full\_name': Deploy 1: Add 'full\_name', write to both. Deploy 2: Backfill 'full\_name' from 'name'. Deploy 3: Switch reads to 'full\_name'. Deploy 4: Stop writing to 'name'. Deploy 5: Drop 'name'. This requires multiple CI/CD runs and temporary storage, but guarantees zero downtime and safe rollback at every step. Common mistakes include trying to do it in one deploy, or forgetting that old code instances keep running during deployment and will crash if columns disappear.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:55:33.978770+00:00— report_created — created