Migrations
Last updated
In its fourth year, Pila outgrows its first server: thirty barangays, three years of records, and a database that's run out of room. Everything has to move to a new host and a new database, without losing a single patient's record or a morning's queue. In this lesson you'll plan a migration the way careful teams do: rehearse it, count and check everything, switch over at a quiet time, and keep a way back. Then you'll see what happened at TSB, a British bank, when a migration was done all at once before the new system was ready.
By the end of this lesson you can
- Plan a data migration in safe, ordered steps
- Check a migration with counts and checksums, not by eye
- Explain why a rehearsal and a way back matter
Why systems move
A migration moves data or a whole system from one place to another. Pila's team will face several over its life:
- A new host, because the first server is too small (this lesson).
- A new database shape, such as splitting
nameintofirst_nameandlast_name. - A new SMS provider, when the old one closes its service.
- The final one: Pila's data moving to the province's regional system (lesson 8.6).
Each is adaptive maintenance (lesson 8.1), and each has the same danger: the old system works, and during the move, data can be lost or changed without anyone noticing.
Plan the move
Put the steps of Pila's move to a new database in a safe order:
- 1 Cutover: point Pila at the new database, at 18:00 on a Saturday
- 2 Rehearse the whole move on a copy, and time it
- 3 Write down how to switch back, and test it on the copy
- 4 Watch the new system closely through Monday morning’s queue
- 5 List everything that moves: tables, files, settings, scheduled jobs
- 6 Compare counts and checksums of old and new
- 7 A month later, switch off and archive the old database
- 8 Freeze writes, and copy the data to the new database
Three ideas carry the plan:
- Rehearse. Do the whole move on a copy first. It finds the surprises (a scheduled job nobody listed, a date stored in the wrong time zone) and tells you how long the real move will take.
- Keep a way back. Until the new system has proved itself, the old one stays ready, and switching back has been tested. Changing a database's shape can be done the same way, in steps that each keep both sides working: Fowler calls it parallel change, with lesson 7.6's expand, migrate, contract.
- Move at a quiet time. For Pila, Saturday evening: the health centres are shut until Monday.
Check it with numbers
After copying, how do you know nothing was lost? Not by opening a few records and seeing they look right. Compare numbers:
| Check | Old | New |
|---|---|---|
| Number of tickets | 412,806 | 412,806 |
| Number of phones | 96,140 | 96,140 |
| Tickets per barangay, per month | 360 counts | 360 counts, all equal |
| Checksum of all ticket rows, sorted | 9f2c…e71a | 9f2c…e71a |
| Earliest and latest ticket date | 3 Mar 2027 · 18 Jun 2030 | 3 Mar 2027 · 18 Jun 2030 |
A checksum (such as SHA-256) is a short fingerprint calculated from data: change a single character anywhere, and the fingerprint is completely different. Equal counts show nothing went missing; equal checksums show nothing changed on the way.
TSB, April 2018
- 2015 A new owner Plan
The review, by the law firm Slaughter and May, found that the platform was “neither stable nor complete” when the migration was approved, and that moving everyone in one weekend left no chance to learn from a smaller first group. Compare it to Pila's plan: a rehearsal that proves readiness, numbers that prove the data, a way back, and, for a big system, moving a small group first.
Spot the trap: “it looks fine”
Saturday, 19:30. The copy has finished. Jun opens ten patient records on the new database and they look right. “It’s fine,” he says. “Let’s switch over and go home.”
What happens if…
Check what you learned
Sources
Every claim on this page comes from these sources: the standard, the founding text of a method, a study, or the official record of a project, from the body that publishes it. Industry reports are labelled as such.
- Slaughter and May: Independent review of TSB’s 2018 migration to a new IT platform: the review commissioned by TSB’s board, published November 2019
- TSB: Slaughter and May review: TSB’s own page for the review and its response
- Martin Fowler: Parallel Change: expand, migrate, contract: changing a shape in safe steps
- Martin Fowler: Strangler Fig Application: moving a piece at a time