Concepts

Expand-and-contract

The pattern Bedrock uses by default for any non-additive schema change. Two deploys, no downtime, fully reversible until the contract step.

The five phases

  • Expand — add the new column/table/relation alongside the old one. Ship.
  • Backfill — populate the new shape from existing data, in batches.
  • Dual-write — app writes both old and new shape behind a feature flag.
  • Cut over — flip reads to the new shape. Soak for the configured window.
  • Contract — drop the old shape in a separate, irreversible migration.

Why two deploys?

Because between deploys, multiple versions of your application code are running simultaneously. The old code expects the old shape; the new code expects the new shape. Expand-and-contract is the only safe way to let both coexist.

Docs · Expand-and-contract — Bedrock