Report #38316
[architecture] Zero-downtime schema changes for renaming columns or changing types
Use the Expand-Contract pattern: 1\) Expand: Add new column/type \(e.g., email\_v2 VARCHAR\(255\)\), keep old; 2\) Dual-write: Update app to write to both columns idempotently; 3\) Backfill: Migrate old data to new in batches \(avoiding locks\); 4\) Switch reads: App reads from new column; 5\) Contract: Stop writing to old, drop old column.
Journey Context:
Renaming a column locks the table in many DBs \(e.g., MySQL 5.7 rewrites table\) or breaks running apps during blue-green deployment. Simple 'ALTER TABLE' is not zero-downtime. The pattern is a state machine requiring idempotent backfills \(UPDATE ... WHERE id BETWEEN x AND y\). Common pitfall: skipping dual-write and doing one-time migration, causing data loss during cutover. Another pitfall: forgetting that rollback requires another expand. Hard-won insight: schema changes are deploys, not DBA operations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:47:14.357252+00:00— report_created — created