The most detailed free FDE + DevOps library: 140+ lessons, 70+ labs and 80 long-form articles, in English and Turkish. Start learning →

DevOps Practitioner · Module 6: Safe delivery and release engineering · Lab

Fix a Backward-Incompatible Schema Change with Expand and Contract

55 min hands-on · Advanced

A local machine with a fixture app and a small database (file or container database); old and new code versions runnable side by side.

Local guide: run the steps below on your own machine in order, then check the validation list.

Objectives

  • Reproduce the mixed-version break of a flag-day rename
  • Migrate through expand, backfill and contract with traffic serving
  • Verify both versions at each phase and the clean final schema
  1. Step 1

    Break it the naive way

    Rename a field in one migration with the code change in one deploy. Run old and new code against it (simulating a rolling update) and quote both failures. This is the fault expand/contract prevents.

  2. Step 2

    Expand and migrate

    Restore, then expand: add the new shape, dual-write, backfill. Switch reads with both versions serving and verified. Quote the per-phase verification.

  3. Step 3

    Contract cleanly

    Search every caller including batch jobs, drop the old shape only with zero references, and verify the suite passes on the final schema. Record the reference search.

How to confirm it worked

  • Naive-break evidence quoted for both versions
  • Three phases each deployed with mixed-version traffic serving
  • Caller search recorded with zero old-shape references
  • Final suite green on the contracted schema