Template Overview

Data migrations are among the highest-risk maneuvers in software engineering. One missing index, corrupted foreign key, or premature DNS switch can cause irreversible data loss and extended outages. The Data Migration Cutover Plan details pre-migration backups, dual-write synchronization phases, validation scripts, cutover checkpoints, and instant rollback procedures in plain Markdown.

Markdown Template Structure

Copy the block below or click Download .md File to add this template directly to your personal vault:

---
title: "Migration Playbook: [Migration Name / DB Source to Target]"
date_scheduled: [YYYY-MM-DD]
cutover_lead: "[[Principal Data Architect]]"
database_source: "Legacy SQLite v3.38 schema"
database_target: "Optimized WAL SQLite v3.46 schema"
maintenance_window_utc: "02:00 - 04:00 UTC"
maximum_acceptable_downtime: "0 Minutes (Zero Downtime Target)"
rollback_plan_tested: true
tags: [database, migration, cutover, playbook, devops, sre]
---

# Data Migration Cutover Plan — [Migration Name]

## 1. Migration Overview & Strategic Objective
- **System Scope:** Upgrade client local vault index database from legacy schema v1 to relational metadata schema v2.
- **Data Volume:** ~50,000 Markdown note index entries and 200,000 full-text search tokens per user vault.
- **Success Criteria:** 100% record integrity, zero data loss, completed in under 12 seconds per gigabyte on Apple Silicon.

## 2. Multi-Stage Cutover Strategy
```text
Phase 1: Shadow Schema Creation ──> Phase 2: Dual Writes Active ──> Phase 3: Background Backfill
       │
       ▼
Phase 4: Integrity Verification ──> Phase 5: Read Cutover ───────> Phase 6: Legacy Decommission

3. Minute-by-Minute Cutover Execution Runbook

Time (T-minus / T+)Step DescriptionExecuting EngineerVerification CommandRollback Trigger
T - 60 minFreeze schema changes in repositoryLead Architectgit status clean on mainAny unmerged migration PR
T - 30 minPerform full snapshot backup of vault indexAutomated scriptsqlite3 vault.db ".backup vault_pre.db"Backup checksum mismatch
T - 10 minRun dry-run migration script on shadow copyData EngineerExit code 0 on dry-runAny schema exception
T + 00 minEXECUTE CUTOVER: Run schema migrationData Engineerpython3 scripts/migrate_v2.pyMigration runtime > 60s
T + 05 minRun data checksum validation queryQA LeadSELECT count(*) FROM v1_notes = v2_notesCount discrepancy > 0
T + 10 minSwitch application read pointer to v2 schemaSystems EngineerApp launches and loads notesApp UI crash on launch
T + 15 minMark legacy schema as read-onlySystems EngineerPRAGMA table_info verification-

4. Integrity Validation Script & Checksums

-- Validate that zero records were dropped during table migration
SELECT 
    (SELECT COUNT(*) FROM legacy_notes) AS legacy_count,
    (SELECT COUNT(*) FROM modern_notes) AS modern_count,
    CASE 
        WHEN (SELECT COUNT(*) FROM legacy_notes) = (SELECT COUNT(*) FROM modern_notes) 
        THEN 'INTEGRITY VERIFIED' 
        ELSE 'ABORT: ROW COUNT MISMATCH' 
    END AS validation_status;

5. Instant Rollback Protocol

[!CAUTION] Rollback Activation If any checksum mismatch or fatal SQL constraint error occurs during T+05, immediately abort migration:

  1. Revert application config pointer to vault_pre.db.
  2. Terminate background migration process.
  3. Post incident notification in war room channel.
  4. Legacy database remains untouched and fully functional.

6. Post-Migration Verification Checklist

  • Full-text search returns accurate results in under 5ms.
  • Vault note creation creates proper rows in new v2 schema.
  • Pre-migration backup securely stored for 30 days.

## Filled Real-World Example

Here is a realistic example demonstrating how this template captures actual deliberations:

```markdown
---
title: "Migration: Vault Index v2 Upgrade"
date_scheduled: 2026-10-07
cutover_lead: "[[Devin Zhao]]"
database_source: "SQLite v1"
database_target: "SQLite v2 (FTS5)"
tags: [database, migration]
---

# Data Migration Cutover Plan — Vault Index v2 Upgrade

## 1. Summary
Devin Zhao led the SQLite full-text search migration across test vaults.

## 2. Result
All 50,000 note entries migrated in 4.2 seconds with 100% record parity. Zero downtime observed.

When to Use and When to Avoid

When to Use

  • Use prior to executing high-risk production database migrations or schema upgrades.
  • Use during platform transitions from legacy systems to modern infrastructure.
  • Use to coordinate multi-engineer teams during weekend or late-night cutover windows.

When to Avoid

  • Avoid using for adding a single non-breaking nullable column to a development database.
  • Avoid using when building prototypes with disposable test data.

On-Device AI Integration

Summarize your recording in Oyma with this local instruction:

Analyze the database schema diff and migration specifications:
1. Break down the migration into sequential zero-downtime phases (shadow, dual-write, backfill, cutover).
2. Formulate explicit minute-by-minute execution runbooks with verification commands.
3. Detail concrete rollback procedures and SQL integrity validation checks in Markdown.

Your data remains securely on your Mac with zero cloud exposure.

Frequently Asked Questions

What is a data migration cutover playbook?

A step-by-step minute-by-minute operational runbook for transferring production data between systems without data corruption or extended downtime.

How does dual-writing ensure zero downtime?

During the migration window, applications write to both the old and new systems simultaneously, allowing real-time data synchronization and risk-free rollbacks.

What happens if a migration fails halfway through?

The playbook defines explicit rollback triggers and execution steps to safely restore the primary legacy database without losing in-flight transactions.