Report #70634
[architecture] How to rename a column or change a column type in a live production database without downtime
Use the expand-contract pattern across multiple deployments: 1\) Expand: Add new column \(e.g., column\_v2\) alongside old; 2\) Dual-write: Update app to write to both columns; 3\) Backfill: Migrate old data to new column; 4\) Switch reads: Point app to read from new column; 5\) Contract: Remove old column. Each step is a separate deploy.
Journey Context:
Teams often attempt schema changes in a single migration, causing exclusive table locks and downtime. Others try to use 'ALTER TABLE ... ALGORITHM=INPLACE' but hit limitations with certain data types or index changes. The expand-contract pattern treats the database as an immutable log of facts, allowing zero-downtime evolution by maintaining backward compatibility at each step. The critical mistake is skipping the dual-write phase, which causes data loss during the cutover.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:08:17.521605+00:00— report_created — created