How can a team change a database schema repeatedly during development and after release without breaking data, other teams or deployments?
When to use it
Agile products where requirements change during delivery. Teams that deploy often and need schema and code released together. Legacy databases that must be refactored without a big-bang rewrite.
Where it comes from
Pramod Sadalage developed the techniques at ThoughtWorks from 2000; he and Martin Fowler published the article 'Evolutionary Database Design' in January 2003 (rewritten May 2016), and the book Refactoring Databases (Ambler and Sadalage) followed in 2006.
Martin Fowler and Pramod Sadalage · 2003
Sheet 2/4
How it works
Every schema change is a small migration script stored in version control with the code. Developers each have their own database copy and apply the same scripts. Automated tests and a continuous integration build run the migrations from scratch and against production-like data. Changes needing compatibility are split into steps, such as adding a new column, copying data, then removing the old one later. This keeps the schema continuously deployable.
You need
Version-controlled migration tooling, a continuous integration pipeline, a test database with representative data, and agreement between developers and DBAs.
You get
An ordered set of migration scripts, a database buildable from zero, and automated tests proving each change.
Sheet 3/4
Case
Illustrative case
Bluepeak Insurance needed to split a 'customer name' column into first and last names while 40 services read it. The team added two new columns and a trigger keeping them synced with the old one, with each change as a numbered migration. Services moved to the new columns over six weeks, each release tested against a copy of production. Once monitoring showed no reads of the old column, a final migration dropped it. No downtime occurred and the sequence was repeated for later refactorings using the same template.
A fictional company used to explain the model.
Sheet 4/4
Caution
When to avoid it
Schemas shared by many external consumers who cannot adapt on your timetable.
Very large datasets where each migration takes hours without special tooling.
Teams with no automated testing.
Common mistakes
Making large migrations that mix many changes.
Editing a migration that already ran elsewhere.
Dropping old columns before consumers have moved.
Leaving DBAs out of the process.
Known weaknesses
Needs strong test automation and discipline
Compatibility steps lengthen each change
Data-heavy migrations can be slow on big tables
Many accumulated migrations need periodic consolidation
How to apply it in 5 steps
How to apply it
Evolutionary Database Design
5 steps
01of 5
Step 1 of 5: Put the schema in version control
Store the baseline schema and every change as ordered scripts alongside the code.
01
02of 5
Step 2 of 5: Give each developer a database
Let everyone build and migrate their own copy from the scripts.
02
03of 5
Step 3 of 5: Make small refactorings
Apply one schema change at a time, using expand-then-contract for compatibility.
03
04of 5
Step 4 of 5: Test automatically
Run all migrations from scratch in CI and test against production-like data.
04
05of 5
Step 5 of 5: Deploy through the pipeline
Release schema and code together with the same automated process.
05
Click to unfold
Use the arrow keys to move between steps, Home and End for the first and last, and Enter to fold or unfold the booklet.
View all 5 steps
01
Put the schema in version control
Store the baseline schema and every change as ordered scripts alongside the code.
02
Give each developer a database
Let everyone build and migrate their own copy from the scripts.
03
Make small refactorings
Apply one schema change at a time, using expand-then-contract for compatibility.
04
Test automatically
Run all migrations from scratch in CI and test against production-like data.
05
Deploy through the pipeline
Release schema and code together with the same automated process.
Which decisions it helps with
Decision profile
A phased process to take action on processes and operations.
Keyboard: Tab to the sheet, use the arrows to explore the assessments and their questions, and press Escape to close the note.
IIdentity
Type of tool
Phased processlikely
The questionWhat kind of tool is it?Assessment · Phased process · 72 %
Decision stage
Plan the work, roles and deadlinespossiblealso: generate ideas or options (27 %)
The questionWhat stage of the decision are you at?Assessment · Plan the work, roles and deadlines · 51 % · also Generate ideas or options · 27 %
What it applies to
Processes and operationspossiblealso: a product or service (47 %)
The questionWhat is the decision about?Assessment · Processes and operations · 52 % · also A product or service · 47 %
Discipline
Agile and software developmentvery likely
The questionWhich discipline does it come from?Assessment · Agile and software development · 100 %
What it produces
A sequence of phases completed in orderlikely
The questionWhat kind of tool is it?Assessment · A sequence of phases completed in order · 72 %
IIIResources required
TimeWeeks or monthsThe questionHow much time can you spend on this?Assessment · Weeks or months · confidence 73 %
PeopleA small group (2 to 8)The questionHow many people will take part?Assessment · A small group (2 to 8) · confidence 28 %
DataBetween “none: experience is enough” and “a few readily available facts”The questionWhat data do you have available?Assessment · Between “none: experience is enough” and “a few readily available facts” · confidence 38 %
ExpertiseWorks best with a facilitatorThe questionDoes anyone have experience with methods like these?Assessment · Works best with a facilitator · confidence 80 %
Time horizonDays or weeksThe questionHow far ahead do you need to plan?Assessment · Days or weeks · confidence 43 %
ScopeOne teamThe questionWho will this decision affect?Assessment · One team · confidence 72 %
FrequencyA regular practiceThe questionIs this a one-off decision or something you expect to repeat?Assessment · A regular practice · confidence 68 %
The team’s own knowledge is enoughThe questionCan you speak to customers, users or people outside your organisation?Assessment · The team’s own knowledge is enough
IITen axes
The dot shows which end the model favours. A hollow dot means no clear preference.
DirectionExecutionThe questionAre you setting direction or improving day-to-day operations?Assessment · Execution · confidence 94 %
Top-downBottom-upThe questionShould leadership set the direction, or should the answer come from the people doing the work?Assessment · Mostly bottom-up · confidence 68 %
PeopleProcessesThe questionIs this mainly a people problem or a process problem?Assessment · Mostly processes · confidence 63 %
Generate optionsNarrow down optionsThe questionDo you need to generate more options or narrow them down?Assessment · Mostly narrow down options · confidence 56 %
Step-by-step analysisIntuition and experienceThe questionWould you rather work through the evidence step by step or draw on the group’s experience?Assessment · Mostly analysis · confidence 64 %
A strict sequence of stepsA flexible frameworkThe questionWould you prefer a precise set of steps or a framework you can adapt?Assessment · Mostly a flexible framework · confidence 57 %
Protect what we haveTake a riskThe questionDo you need to protect what you have or take a chance on something new?Assessment · Mostly protect · confidence 78 %
Improve what we haveFundamental changeThe questionDo you want to improve what you have or change it fundamentally?Assessment · Improve what we have · confidence 63 %
Inside the organisationOutside the organisationThe questionWhere do you expect to find the answer, inside your organisation or in the market?Assessment · Inside the organisation · confidence 77 %
Understand firstAct nowThe questionDo you need to understand the situation first or act now and learn as you go?Assessment · Mostly act now · confidence 73 %
IVUseful when
Applicable traits
How it supports actionDecide what comes firstThe questionWhat do you need in order to act?Assessment · Decide what comes first · 92 %
How was this profile calculated?
An automated system reads each model card and answers the same questions for every model. This profile has answers for 77 of 77. No answers are entered by hand.
A very high probability counts as “yes” and a very low one as “no”. Intermediate answers are hidden.
On the axes, mixed means the model favours neither end.