Part 5 of a series reading Continuous Delivery, by Jez Humble and David Farley. Part 1: Continuous Delivery Is a State, Not a Pipeline.
Everything so far has a quiet assumption baked into it. The pipeline promotes an artifact. A bad release rolls back. Deploy is cheap because you can always undo it.
Then someone points at the database and the whole thing gets nervous.
Because code is easy to take back and data is not. You can redeploy last week’s binary in seconds. You cannot redeploy last week’s schema once this week’s code has been writing into it, and you certainly cannot un-drop a column that a migration deleted at 2am. So teams that ship code ten times a day still batch every schema change into a dreaded quarterly “migration window,” take the site down, and pray.
That is the reputation: the database is where Continuous Delivery goes to die. The most common reason people say zero-downtime releases are impossible for a “real” app is the one sitting behind the API.
The book’s answer is that it isn’t a database problem. It’s the same problem you already solved.
Incremental change: rather than a big-bang migration, you make a series of small, reversible changes, each of which keeps the system working.1
You decouple schema change from deploy the same way you decoupled deploy from release. In Part 1, a feature flag let a deploy happen without a release — code shipped dark, turned on later. Here, a compatibility window lets a schema change happen without a coordinated deploy — the database changes shape while every running version of the app keeps working.
The database breaks the illusion
The reason a schema change feels dangerous is that people do it as one atomic move: change the code and the schema together, in lockstep, and hope they land at the same instant.
They never do. During any real deploy there is a window — seconds to minutes — where old app instances and new app instances are both running against the same database. If the new schema breaks the old code, every request that hits an old instance during that window fails. So you take the site down to shrink the window to zero.
That maintenance window is not a fact of databases. It is the cost of coupling two changes that did not need to be coupled.
Expand, migrate, contract
So how do you rename a column — the simplest schema change there is, and a classic downtime excuse — without ever taking the app down?
You never change it in place. You add the new shape alongside the old, move everything across in small reversible steps while both work, and only remove the old shape once nothing uses it. Expand, migrate, contract.2
Walk through it. Watch the badge.
Step 1 / 5Add the new column, nullable
Step 2 / 5Backfill existing rows
Step 3 / 5Deploy v2 — dual-write
Step 4 / 5Switch reads to the new column
Step 5 / 5Drop the old column
An additive change. The new column is nullable, so the running app doesn't know or care it exists. Nothing to deploy in lockstep, nothing to break.
Copy zip → postal_code for every existing row, in the background. The app keeps serving from zip throughout; the backfill is invisible to it.
Now the interesting moment: v1 and v2 run side by side during the rollout. v2 writes both columns, so whichever version serves a request, both columns stay correct. Both work.
Once every instance is v2, flip reads to postal_code. zip is still written, so a rollback to a zip-reading version is instant and safe. The change is reversible right up to the last step.
Only now, when nothing reads or writes zip, do you drop it. Removing an unused column is itself a safe, additive-in-reverse change. The rename is complete, and the site never went down.
The green badge is the whole point, and it is not decoration — it is the invariant. At every single step, both the old app version and the new one can serve a request correctly. That is what makes each step safe to deploy on its own schedule, and safe to roll back. There is no instant where the schema and the code have to be in sync, so there is no window to take offline.
Notice that nothing in there was clever. Add a nullable column. Backfill it. Write both for a while. Switch reads. Drop the old one. Five boring, individually-reversible steps replace one terrifying atomic one — the same small-steps move refactoring makes with code, applied to data.
Backward compatibility is the contract
The property holding all of this together has a name: backward compatibility. Every migration must leave the database usable by the app version that came before it.
That single rule is what lets deploy and migrate stop being simultaneous. Because the old code still works against the new schema, you can migrate first and deploy later. Because the new code still writes what the old code needs (the dual-write step), you can roll the deploy back mid-flight and nothing is stranded. The compatibility window is the safety net that makes the trapeze act boring.
Break that rule — ship a migration that only the new code can tolerate — and you are back to a coordinated, all-at-once, take-it-offline release. Every downtime migration you have ever suffered was, underneath, a backward-incompatible change someone tried to do in one step.
deep diveWhy not just take a two-minute maintenance window? It's simpler.
Because “simpler” is borrowing against the future at a bad rate. A two-minute window sounds harmless until you count what it actually costs: you can now only migrate during a scheduled downtime, so migrations get batched up to “make the window worth it,” so each one is bigger and riskier — which is exactly the large-batch trap from Part 1, wearing a database hat. And a global business that never sleeps has no good two minutes. The expand/contract dance is a few more steps up front, but each step is trivial and reversible, and it buys you the ability to change the schema any day, mid-afternoon, with users online and nobody holding their breath. You are trading a recurring, compounding tax for a one-time bit of care.
Migrations are versioned, tested, reversible code
The last piece is a mindset shift the book insists on: a migration is not a one-off script someone runs by hand. It is code, and it earns the same standards as the rest of your code.1
It lives in version control, next to the change that needs it. It runs in the pipeline — applied automatically to every environment, so a migration that fails does so in the commit stage, not in production. It is ordered and repeatable, so any database can be brought to any version deterministically. And, wherever possible, it is reversible — a down-migration that has itself been run, not a hopeful comment.
The database stops being the place CD goes to die the moment you stop treating schema changes as special. They’re just more changes: small, backward-compatible, versioned, tested, and reversible — flowing through the same pipeline as everything else.
So, how do you ship a database?
Not in a window. Not in a lockstep deploy. Not by hand at 2am.
You expand before you contract. You keep every step backward-compatible, so the old and new code both work and deploy and migration never have to be the same event. You put migrations in version control and run them through the pipeline like any other code. Do that, and “we have a real database” stops being the reason you can’t practice Continuous Delivery.
Next in the series: the finale — how you measure whether any of this is actually working, and the one idea I’m taking with me from the whole book.
Footnotes
-
Martin Fowler and Pramod Sadalage, Evolutionary Database Design — treating the schema as something that changes continuously and safely, with migrations kept in version control and applied through automation. The idea runs throughout Humble & Farley’s Continuous Delivery. ↩ ↩2
-
Danilo Sato, ParallelChange (expand/contract) — make a breaking change safe by expanding to support both old and new, migrating over, then contracting to remove the old, so consumers never see a broken state. ↩

