run-migrationlisted
Install: claude install-skill zakariaf/CatchLaw
# Run migration (forward-only Drift schema migration)
Apply a schema change to a local Drift/SQLite database by following the exact
ordered ritual below. In an offline-first app there is no server and no re-sync
path, so the on-device DB is the single source of truth: a migration that drops
or corrupts a column permanently destroys hand-entered records that exist
nowhere else, and with no telemetry nobody ever reports it — the user just
uninstalls. This is a **manual, low-freedom, human-run** workflow. Execute the
steps in order; do not improvise, reorder, or skip.
## Non-negotiable rules
1. **Take the pre-migration snapshot FIRST — before the database is opened.**
Do it at the composition boundary that opens `AppDatabase`, never inside
`onUpgrade`: `PRAGMA wal_checkpoint(TRUNCATE)` any live handle so the `-wal`
is folded into the main file, then copy the DB file **and its `-wal`/`-shm`
sidecars** while nothing holds the file open. Opening the database is what
triggers the migration. Never copy or overwrite bytes under a live
connection. The snapshot is the only "rollback" SQLite has; restore it on any
failure.
2. **Forward-only. Never write a down migration.** SQLite has no true down
migration and you must not pretend to. "Rollback" means restore the snapshot,
nothing else.
3. **Steps are append-only — NEVER edit a shipped step.** Editing a released
step corrupts data for every user who skips versions. To fix a bug in a prior
step, add a *