generated from john/python-template
2.5 KiB
2.5 KiB
V1 Data Migration and Recovery Guidance
This document defines migration/backfill and rollback guidance for the V1 SQLite baseline.
Purpose
- provide safe procedures for local schema evolution and recovery
- reduce data-loss risk during version upgrades
- establish repeatable pre-change and post-change checks
Current Baseline
- canonical relational store: SQLite
- default DB path:
./transcription.db - schema bootstrap may apply compatibility updates for dev/test scenarios
Pre-Change Checklist
Before changing runtime version or schema behavior:
- Stop the app process.
- Create a timestamped DB backup copy.
- Capture current app commit/version.
- Export a quick status inventory:
- job counts by status
- total documents/sources/revisions
- Ensure sufficient disk space.
Backup Procedure (SQLite)
Minimum procedure:
- Stop app.
- Copy DB file to a safe location with timestamp.
- Store backup path in release notes or change log.
Upgrade Procedure (V1)
- Perform pre-change checklist.
- Deploy updated app version.
- Start app and observe startup logs.
- Verify schema bootstrap completes (if enabled).
- Run smoke flow:
- upload valid file
- observe terminal status
- open job detail
Backfill Guidance
V1 backfill is limited and conservative:
- for records missing newly introduced non-null defaults, use explicit one-time SQL updates only after backup
- avoid destructive rewrites of
Job.textorRevision.text - never backfill by overwriting original immutable transcription output
Rollback Procedure
If upgrade fails or causes data inconsistency:
- Stop app.
- Restore prior DB backup file.
- Revert app version to last known-good commit.
- Restart app.
- Run smoke flow and confirm stability.
Recovery Scenarios
Stale processing jobs after crash/restart
- restart app and allow stale-job recovery to re-queue timed-out
processingjobs - monitor for terminal progression
Schema mismatch symptoms
- errors during startup or writes indicating missing columns/indexes
- rollback to last good DB + app version
- reattempt with documented upgrade path
Validation Evidence
For each upgrade rehearsal, capture:
- backup filename/path
- pre and post job status counts
- smoke test result
- rollback rehearsal result (recommended)
Operational Constraints
- treat DB backups as required before non-trivial upgrades
- do not perform in-place DB edits while app is running
- do not skip post-upgrade smoke validation