expand-and-contract

A way to change a live database in safe steps: add the new structure, move data and code to it, then remove the old structure.

In more detail

To split a name column into first and last, you first add the new nullable columns (expand), backfill them from the old one, switch every service to the new columns, and only then drop the old column (contract). Each step works with both the old and the new code, so rolling deployments never break.

Related terms

Taught in

References