Migration Plan Template
System or data migration: strategy, phases, data mapping, reconciliation, cutover runbook, rollback, decommissioning
Cách dùng: Use it before moving a system, database or user population to a new platform. Fill scope, current and target state and the strategy first, then agree rollback triggers with numbers before writing the runbook. The main pitfall is reconciliation without thresholds, so a migration looks done while data is missing.
Xem trước
Migration Plan: [System or data set] from [Source] to [Target]
Migration plan for moving a system, a data set or a user population from a source platform to a target platform without losing data, availability or trust. It covers scope, current and target state, strategy (big bang, phased, dual-write/dual-read, strangler), phases, data mapping, validation and reconciliation, the cutover runbook, rollback, communication, risks, success criteria and decommissioning. It is based on common industry practice for system and data migrations. Replace every
[bracketed]value and every row marked Example.
Document control
| Field | Value |
|---|---|
| Document ID | [MIG-PROJECT-001] |
| Migration name | [Orders database move from self-managed PostgreSQL 12 to managed PostgreSQL 16] |
| Migration type | [System / Data / Platform / Tenant or user population] |
| Version | [0.1] |
| Status | [Draft / In review / Approved / In flight / Completed / Rolled back] |
| Migration owner | [@name] |
| Technical lead | [@name] |
| Planned window | YYYY-MM-DD to YYYY-MM-DD |
| Cutover date | YYYY-MM-DD HH:MM UTC |
| Classification | [Internal / Confidential] |
| Related documents | [ADR-0042, SDD-ORDERS-003, RUNBOOK-DB-07] |
Approvals
| Role | Name | Decision | Date |
|---|---|---|---|
| Migration owner | [@name] | [Approved] | YYYY-MM-DD |
| Engineering lead (source system) | [@name] | [Approved] | YYYY-MM-DD |
| Engineering lead (target system) | [@name] | [Approved] | YYYY-MM-DD |
| Data owner | [@name] | [Approved / Approved with conditions] | YYYY-MM-DD |
| Security or privacy reviewer | [@name] | [Approved] | YYYY-MM-DD |
| Change advisory or release manager | [@name] | [Approved for window] | YYYY-MM-DD |
Revision history
| Version | Date | Author | Change summary |
|---|---|---|---|
| 0.1 | YYYY-MM-DD | [@name] | First draft for strategy review |
| 0.2 | YYYY-MM-DD | [@name] | Example: Switched from big bang to dual-write after load test showed a 9 hour backfill |
| 1.0 | YYYY-MM-DD | [@name] | Approved for cutover |
Contents
1. Scope and objectives
This section defines what is migrated, why, and what is explicitly left out.
1.1 Purpose
Example: Move the orders service and its 1.8 TB PostgreSQL 12 database from self-managed virtual machines to a managed PostgreSQL 16 service, so that the team stops running end-of-life database software and gains automated backups, point-in-time recovery and minor-version patching.
1.2 In scope
| ID | Item | Notes |
|---|---|---|
| SC-01 | Example: orders database, 41 tables, 1.8 TB | Including history tables from 2019 |
| SC-02 | Example: orders-api and orders-worker services | Connection strings and pool settings |
| SC-03 | Example: Nightly export job to the data warehouse | Re-pointed to the new read replica |
| SC-04 | [Item] | [Notes] |
1.3 Out of scope
| Item | Reason | Owner of follow-up |
|---|---|---|
Example: audit_log archive older than 7 years | Retention policy allows deletion; deleted before migration | [@data-owner] |
Example: Schema redesign of order_items | Separate project; migration is like-for-like | [@tech-lead] |
| [Item] | [Reason] | [@name] |
1.4 Objectives and constraints
- Objectives: [no data loss; downtime below 15 minutes; no change to public API behaviour].
- Constraints: [cutover outside peak trading hours; freeze on unrelated releases during the window; budget cap of the dual-run period].
- Assumptions: [target environment provisioned and security-approved by YYYY-MM-DD; source write volume stays below 1,200 writes per second].
2. Current state
This section records the source system and every dependency that touches it.
| Aspect | Current state |
|---|---|
| Platform | Example: PostgreSQL 12.17 on 2 VMs (primary plus streaming replica) |
| Data volume | Example: 1.8 TB, largest table order_events 1.1 TB, 2.3 billion rows |
| Write rate | Example: peak 950 writes/s, average 310 writes/s |
| Consumers | Example: orders-api, orders-worker, BI export, finance reconciliation script |
| Integrations | Example: logical replication slot read by CDC pipeline |
| Known issues | Example: 3 tables without primary keys; mixed timestamp and timestamptz |
2.1 Dependency inventory
List every reader and writer. Discover them from connection logs, not from memory.
| Consumer | Access | Frequency | Owner | Migration action |
|---|---|---|---|---|
| Example: orders-api | Read/write | Continuous | [@team-orders] | Switch connection string via config flag |
Example: finance-recon.py on host fin-01 | Read only | Daily 01:00 | [@finance-eng] | Re-point and test in staging |
| [Consumer] | [Access] | [Frequency] | [@owner] | [Action] |
3. Target state
This section describes where the system will be when the migration is complete.
| Aspect | Target state | Difference from current |
|---|---|---|
| Platform | Example: Managed PostgreSQL 16, multi-AZ | Major version upgrade; managed failover |
| Data volume | Example: 1.5 TB after purge of expired archive | 0.3 TB deleted under retention policy |
| Consumers | [Same list, new endpoints] | [Connection pooling via proxy] |
| Backup and recovery | Example: PITR 14 days, RPO 5 min, RTO 1 h | Previously nightly dumps only |
| Security | Example: TLS required, IAM authentication | Previously password authentication |
The following diagram shows the target topology and the temporary migration path used during the dual-run period.
4. Migration strategy
This section records the chosen pattern and why the others were rejected.
4.1 Strategy options
| Strategy | How it works | Downtime | Complexity | Best when |
|---|---|---|---|---|
| Big bang | Stop writes, copy everything, switch all consumers at once | Hours, proportional to data size | Low | Small data, tolerant users, simple rollback |
| Phased | Move tenants, regions or modules in waves | Minutes per wave | Medium | Data partitions cleanly by tenant or region |
| Dual-write / dual-read | Application writes to both systems, reads shift gradually after comparison | Near zero | High | Zero-downtime requirement, application under team control |
| Strangler | New system takes over functions one route at a time behind a facade | Near zero | High, spread over months | Replacing a legacy application, not just its storage |
| Replication-based | Database-native or CDC replication, then short write freeze and switch | Minutes | Medium | Like-for-like storage moves |
4.2 Chosen strategy and rationale
Example: Replication-based with a short write freeze, combined with phased consumer switching for read-only consumers. Logical replication keeps the target within seconds of the source; read-only consumers move first, then a 10 minute write freeze switches the writers. Big bang was rejected because a full copy takes about 9 hours at the measured throughput. Dual-write was rejected because it requires changes to two services and introduces consistency risk with no benefit for a like-for-like move.
4.3 Consequences
- [Downtime budget: 10 minute write freeze; reads available throughout].
- [Temporary cost: both databases run for up to 30 days].
- [Operational load: replication lag must be monitored and alerted during the dual-run period].
5. Phases and schedule
The migration runs in the following phases. A phase starts only when the previous one has met its exit criteria.
| Phase | Goal | Entry criteria | Exit criteria | Owner |
|---|---|---|---|---|
| P0 Preparation | Target provisioned, tooling ready | Plan approved | Target passes security review and load test | [@platform] |
| P1 Rehearsal | Full dry run in staging | P0 exit | Rehearsal completed within window, reconciliation 100% | [@tech-lead] |
| P2 Initial load and sync | Copy data, start replication | P1 exit | Lag below 5 s for 72 h | [@dba] |
| P3 Read consumers switch | Move read-only consumers | P2 exit | Consumers healthy for 7 days | [@team-leads] |
| P4 Cutover | Move writers | Go decision at T-1 h | Success criteria in section 12 met | [@migration-owner] |
| P5 Hypercare | Watch, fix, stabilise | P4 exit | 14 days without Sev 1 or Sev 2 related to migration | [@on-call] |
| P6 Decommission | Remove source | P5 exit | Source deleted, costs stopped | [@platform] |
The schedule below is indicative; adjust the dates and durations.
6. Data mapping and transformation
This section maps source structures to target structures and records every transformation rule.
6.1 Field mapping
| Map ID | Source table.field | Target table.field | Type change | Transformation rule | Invalid value handling |
|---|---|---|---|---|---|
| DM-001 | Example: orders.created_at (timestamp) | orders.created_at (timestamptz) | Yes | Interpret as UTC | Reject row, log to quarantine |
| DM-002 | Example: orders.status (varchar) | orders.status (enum) | Yes | Map 'cancelled' and 'canceled' to canceled | Unknown value goes to quarantine |
| DM-003 | Example: customers.phone | customers.phone_e164 | Format | Normalise to E.164 | Keep original in phone_raw |
| DM-004 | [Source] | [Target] | [Yes/No] | [Rule] | [Handling] |
6.2 Data quality and cleansing
- [Known defects found by profiling and how each is handled: fixed at source, transformed, quarantined or accepted].
- [Rows without primary keys: surrogate key added before replication].
- [Personal data: confirm lawful basis and retention before copying; do not copy data that is due for deletion].
6.3 Quarantine
Rows that fail transformation go to a quarantine table with the source key, the failing rule and a timestamp. The data owner reviews quarantine daily during the migration; the target is zero unresolved rows at cutover.
7. Validation and reconciliation
Reconciliation proves that the target holds the same data as the source, after transformation. Each check below has a threshold and an owner.
7.1 Metrics
The row-count match rate for a table compares target and source counts after excluding rows that were deliberately quarantined or filtered:
The checksum match rate compares per-row hashes over the mapped columns, computed on both sides with the same canonical serialisation:
For very large tables, compare a random sample of rows. With and zero mismatches, the 95% upper bound on the mismatch rate is about (the rule of three).
7.2 Checks and thresholds
| Check ID | Check | Scope | Threshold | When | Owner |
|---|---|---|---|---|---|
| VR-01 | Row count match | All tables | exactly | Rehearsal, T-1 h, T+15 min | [@dba] |
| VR-02 | Checksum match | Tables under 50 M rows | Rehearsal, T+30 min | [@dba] | |
| VR-03 | Sampled checksum | Tables over 50 M rows | 0 mismatches in 10,000 rows | T+30 min | [@dba] |
| VR-04 | Aggregate totals | Example: sum of order_total per day | Equal to the cent | T+30 min | [@finance-eng] |
| VR-05 | Replication lag | Source to target | Below 5 s before freeze, 0 at switch | Continuous | [@on-call] |
| VR-06 | Application smoke tests | Critical journeys | 100% pass | T+10 min | [@qa] |
7.3 Mismatch handling
A failed check is investigated before the next runbook step. If the cause cannot be found within [30 minutes], the go/no-go owner applies the rollback triggers in section 9.
8. Cutover runbook
The runbook below is executed in a bridge call with the migration owner as coordinator. Each step is checked off in the log in Appendix B.
| Step | Time | Action | Command or link | Expected result | Owner |
|---|---|---|---|---|---|
| 1 | T-24 h | Confirm go/no-go prerequisites | Checklist in 8.1 | All items green | [@migration-owner] |
| 2 | T-1 h | Final go/no-go decision | Bridge call | Recorded decision | [@migration-owner] |
| 3 | T-30 min | Post "maintenance starting" notice | Status page template | Notice live | [@comms-lead] |
| 4 | T-10 min | Enable write freeze | [feature flag orders.write_freeze=on] | Write rate drops to 0 | [@tech-lead] |
| 5 | T-8 min | Confirm replication lag is 0 | [lag query] | Lag 0 bytes | [@dba] |
| 6 | T-5 min | Run VR-01 on all tables | [reconcile --counts] | All match | [@dba] |
| 7 | T-2 min | Advance sequences on target | [script] | Sequences above source max | [@dba] |
| 8 | T | Switch connection target | [config change orders.db=target] | Services connect to target | [@tech-lead] |
| 9 | T+2 min | Disable write freeze | [flag off] | Writes succeed on target | [@tech-lead] |
| 10 | T+10 min | Smoke tests VR-06 | [test command] | 100% pass | [@qa] |
| 11 | T+30 min | Checksums VR-02 to VR-04 | [reconcile --checksums] | Thresholds met | [@dba] |
| 12 | T+60 min | Declare cutover complete or roll back | Bridge call | Decision recorded | [@migration-owner] |
8.1 Go/no-go checklist
- Rehearsal completed within the planned window with full reconciliation.
- Replication lag below threshold for the last 72 hours.
- Rollback procedure rehearsed and reverse replication ready.
- On-call and decision makers confirmed on the bridge.
- Communications drafted and approved.
- No open Sev 1 or Sev 2 incidents on dependent systems.
9. Rollback
This section defines when and how the migration is reversed.
9.1 Rollback triggers
| Trigger ID | Condition | Measured by | Decision owner |
|---|---|---|---|
| RB-01 | Error rate above 2% for 5 minutes after switch | API dashboards | [@migration-owner] |
| RB-02 | Any reconciliation check VR-01 to VR-04 fails and is not explained within 30 minutes | Reconciliation report | [@migration-owner] |
| RB-03 | p99 latency above 2x baseline for 15 minutes | APM | [@migration-owner] |
| RB-04 | Data corruption observed by any consumer | Incident report | [@migration-owner] |
9.2 Rollback procedure
- Enable the write freeze.
- Confirm reverse replication (target to source) has applied all writes made since T; otherwise export them from the target change log.
- Switch the connection target back to the source.
- Disable the write freeze and run smoke tests.
- Post the rollback notice and open an incident record.
9.3 Point of no return
Example: Reverse replication is kept for 7 days after cutover. After the source is set read-only and reverse replication stops (start of P6), rollback is no longer possible and issues are fixed forward.
10. Communication plan
Communication is owned by the comms lead and approved by the migration owner.
| Audience | Message | When | Channel | Owner |
|---|---|---|---|---|
| Engineering teams consuming the data | Plan, freeze window, consumer actions | T-14 days, T-2 days | [Engineering channel, email] | [@migration-owner] |
| Support and customer success | Expected impact, customer wording | T-7 days | [Briefing] | [@comms-lead] |
| Customers | Maintenance notice | T-72 h and T-30 min | Status page | [@comms-lead] |
| Executives | Go/no-go outcome, completion | T-1 h, T+60 min | [Email] | [@migration-owner] |
| All | Completion or rollback notice | T+60 min | Status page and channel | [@comms-lead] |
11. Risks and mitigations
Risk score is likelihood times impact, each on a 1 to 5 scale, so ranges from 1 to 25; scores of 12 or more need a mitigation tested in rehearsal.
| Risk ID | Risk | L | I | Score | Mitigation | Owner |
|---|---|---|---|---|---|---|
| MR-01 | Example: Hidden consumer still writes to the source after cutover | 3 | 5 | 15 | Revoke write grants on source at T; monitor source connections | [@dba] |
| MR-02 | Example: Query plans regress on new major version | 3 | 4 | 12 | Replay production queries in rehearsal; compare plans | [@tech-lead] |
| MR-03 | Example: Sequence collision after switch | 2 | 5 | 10 | Step 7 advances sequences with a safety gap | [@dba] |
| MR-04 | Example: Cutover overruns the window | 2 | 3 | 6 | Rehearsed timings; hard stop at T+90 min triggers rollback | [@migration-owner] |
| MR-05 | [Risk] | [L] | [I] | [S] | [Mitigation] | [@owner] |
12. Success criteria
The migration is complete when all of the following hold:
| ID | Criterion | Target | Evidence |
|---|---|---|---|
| SUC-01 | Data completeness | VR-01 to VR-04 pass | Reconciliation report |
| SUC-02 | Downtime | Write freeze at most 15 minutes | Runbook log timestamps |
| SUC-03 | Performance | p99 latency within 10% of baseline for 7 days | APM dashboard |
| SUC-04 | Stability | No migration-related Sev 1 or Sev 2 during hypercare | Incident log |
| SUC-05 | Consumers | Every consumer in 2.1 confirmed on target | Sign-off list |
13. Decommissioning
Decommissioning removes the source once success criteria are met and the point of no return has passed.
| Step | Action | Verification | Owner |
|---|---|---|---|
| D-01 | Set source read-only and stop reverse replication | Write attempts rejected | [@dba] |
| D-02 | Take a final encrypted backup and store it per retention policy | Backup restore test passes | [@dba] |
| D-03 | Remove DNS entries, credentials, firewall rules and monitoring | No residual access | [@platform] |
| D-04 | Delete source instances and storage | Billing shows zero cost | [@platform] |
| D-05 | Update runbooks, architecture docs and the dependency inventory | Docs reviewed | [@tech-lead] |
| D-06 | Hold a retrospective and record lessons | Retro notes linked | [@migration-owner] |
14. Appendices
Appendix A. Glossary
| Term | Meaning |
|---|---|
| Cutover | The moment writers switch from source to target |
| Write freeze | A period in which the application rejects or queues writes |
| Reconciliation | Comparing source and target to prove completeness and correctness |
| Hypercare | The period of heightened monitoring after cutover |
Appendix B. Cutover log
| Time (UTC) | Step | Result | By | Notes |
|---|---|---|---|---|
| HH:MM | [Step number] | [Done / Failed / Skipped] | [@name] | [Notes] |
Appendix C. Rehearsal results
| Rehearsal | Date | Duration | Reconciliation | Issues found |
|---|---|---|---|---|
| Example: R1 staging | YYYY-MM-DD | 52 min | 100% | Sequence step missing; added as step 7 |
Standard and licence note
Based on common industry practice for system and data migrations (replication-based moves, phased waves, dual-write and the strangler pattern), with reconciliation and rollback practices commonly used in database and platform engineering. No named standard is reproduced. Template licence: MIT.
Template liên quan
Software Maintenance Plan Template (ISO/IEC/IEEE 14764)
Maintenance concept, types, organisation, request process, metrics (backlog, MTTR), SLAs, CM, transition, budget, retirement
Phần mềm & Kỹ thuậtIncident Postmortem Template
Blameless incident postmortem: severity per matrix, impact and error budget, UTC timeline, root cause, 5 Whys, security incident links, action items
Phần mềm & Kỹ thuậtProduction Readiness Review Template
PRR evidence: architecture, SLOs, capacity, observability, alerting policy and security logging conformance, on-call, Kubernetes baseline, backup tier and DR evidence, security, sign-off