# Data migration and cutover checklist

From ArchitectureCompass (https://architecturecompass.com/toolkit/checklists/data-migration/). Free to use and adapt.

A data migration runs once in production, so it gets the least testing of any code you'll write and carries some of the highest risk. Every item here maps to a way migrations fail in practice, most of them silently.

**When to use it:** When designing a migration, before each rehearsal, and as the gate before cutover.

## Scope and ownership

- [ ] Every entity to be migrated is listed, with its source and target system of record.
- [ ] Data that won't be migrated is listed too, with where it will be kept and for how long.
- [ ] A business owner signs off the mapping and the definition of "correct" for each entity.
  - *Why:* Engineers can prove data moved; only the business can say it means the same thing.
- [ ] Data quality problems in the source are measured, and each has a decision: fix before, fix during, or carry over.

## Mapping and transformation

- [ ] Every target field has a documented source and transformation rule, including defaults and lookups.
- [ ] Units, currencies, time zones and code values are mapped explicitly, with worked examples.
- [ ] Identifiers are mapped one to one, and the mapping table itself is tested.
  - *Why:* One swapped row in an ID mapping table moves every record it touches to the wrong owner, and totals won't show it.
- [ ] Records that fail transformation go to an error store with the reason, rather than being dropped.

## Changes during the migration

- [ ] The approach for changes made while the migration runs is chosen: freeze, change data capture or dual writes.
- [ ] Every write to the target carries the source revision or log position, and older writes can't overwrite newer ones.
  - *Why:* When a backfill and a live stream write the same row, the last writer wins, not the newest data.
- [ ] Deletes in the source are carried to the target, not only inserts and updates.
- [ ] The plan handles schema changes in the source during the migration window, or forbids them.

## Verification

- [ ] Reconciliation compares every record by key, reporting missing, extra and different records, not only counts and totals.
- [ ] Business invariants are checked on the target, such as balances that match transactions, or one active address per customer.
- [ ] Sample records are checked end to end by business users in the target application, not only in the database.
- [ ] Performance of the target with full data volumes is tested, including the worst reports and batch jobs.
- [ ] Shadow comparison, if used, reports every eligible request, including timeouts and errors, not only completed pairs.

## Rehearsal

- [ ] At least one full rehearsal runs with production-size data, timed end to end.
  - *Why:* The time a full migration takes is almost never what was estimated, and the cutover window depends on it.
- [ ] Each rehearsal produces a report of defects found, and the next rehearsal shows them fixed.
- [ ] The rollback is rehearsed with writes made after the switch, and those writes are recovered.

## Cutover

- [ ] A runbook lists every step with an owner, an expected duration and a check that it worked.
- [ ] Go/no-go criteria are agreed in advance and written down, including the reconciliation results required.
- [ ] The point of no return is explicit: until then, rollback is possible; after it, problems are fixed forward.
- [ ] Communication to users and support teams is scheduled for before, during and after cutover.
- [ ] The source system is made read-only at cutover so it can't silently diverge.

## Rollback

- [ ] Writes made on the target after cutover are replicated back, or captured for replay, until the point of no return.
- [ ] The rollback has a time limit and a decision owner.
- [ ] The target can only accept data the source can represent until the point of no return.
