Zero-Downtime Column Renames
Add new column, dual-write, backfill, switch reads, drop the old — the canonical zero-downtime rename pattern.
The Naive Approach Breaks
ALTER TABLE t RENAME COLUMN a TO b; is metadata-only — fast. BUT the app expects column "a"; after the rename, every query reading "a" breaks.
Strategy: Expand → Migrate → Contract
The canonical zero-downtime pattern:
- Expand — add the new column without removing the old
- Have the app write to both for a while
- Migrate — backfill historical data into the new column
- Switch reads to the new column
- Contract — drop the old column