pattern

Expand and Contract

also called Parallel Change, Expand-Migrate-Contract

Changing a schema or contract in three deployable steps so old and new code are correct at every moment.

schemamigrationcompatibility

Any schema change that is not backward compatible is incompatible with rolling deployment, because during a rollout both versions of the code are live at once. Expand and contract is how you make the change anyway.

Expand: add the new column, table or field, nullable and unused. Deploy. Migrate: write to both old and new, backfill existing rows in batches, then move reads to the new shape once the backfill is verified. Contract: remove the old field and the dual-write, only after nothing reads it — which you confirm with telemetry, not with a code search.

Renaming a column is the canonical example and shows why the naive version fails: a rename in a single migration breaks every instance still running the previous release, and breaks rollback permanently, because the old code cannot find the column it needs.

The discipline it demands is patience. The contract step is boring, unglamorous and routinely never done, which is how systems accumulate columns with version numbers in their names that three services still dual-write to years later.