Problem
Renaming a column or changing an API in one step breaks whichever application version is not yet updated. During rolling deploys, rollbacks or multiple consumers, a breaking change forces downtime or a risky big-bang coordination.
Also known as: parallel-change, expand-and-contract, backward-compatible-migration
Change a schema or interface in compatible phases so old and new application versions work against it simultaneously, enabling zero-downtime releases.
Renaming a column or changing an API in one step breaks whichever application version is not yet updated. During rolling deploys, rollbacks or multiple consumers, a breaking change forces downtime or a risky big-bang coordination.
Expand-contract, also called parallel change, makes incompatible changes compatible by never doing the breaking part and the dependent part together. Think of it as building a second bridge before demolishing the first.
Take renaming the column fullname to display_name.
1 EXPAND add column display_name (nullable)
2 WRITE app writes both columns
3 BACKFILL copy fullname into display_name in batches
4 READ app reads display_name
5 CONTRACT stop writing fullname, then drop column
Each numbered step is its own deploy. After step 2, a rollback to the earlier app version is safe because the old column is still maintained. After step 4, rollback to the previous release still works because both columns hold data.
ALTER TABLE users ADD COLUMN display_name text;
The same shape applies to APIs: add the new field, support both, migrate clients, then remove the old one after usage drops to zero.
Low - temporary extra storage
Medium - backfills and phased releases
Medium - sequencing discipline
Dual writes diverge and the new column holds stale data
Contract step runs before a lagging consumer migrates
Backfill locks a hot table and causes an outage