patternMajorpendingCanonical
Database migration strategy -- zero-downtime schema changes
Viewed 0 times
schema migrationzero downtimeexpand contractrolling deployment
Problem
Schema changes require coordinated app and DB updates. Rolling deployments mean old and new versions coexist.
Solution
Expand-contract: (1) Add new column alongside old. (2) Backfill and dual-write. (3) Remove old column after all instances updated. Never add NOT NULL without defaults.
Why
During rolling deployments, old instances still read/write old schema. Removing a column before update crashes old instances.
Revisions (0)
No revisions yet.