A migration script run during routine maintenance corrupted the
file_versions
table on the primary SQLite database for 47 accounts.
Affected users could not access file history or resolve conflicts.
No files were lost; sync continued in last-write-wins
fallback mode.
Incident Timeline
09:14 Automated monitor fires sync_error_rate > 5% alert ▶
Who noticed
PagerDuty → @marco (on-call)
Action taken
Acknowledged; started investigating error logs
09:22 Root cause identified: migration 0041 corrupted SQLite WAL ▶
Who noticed
@marco + @priya
Action taken
Migration halted; database put in read-only mode. Migration
0041_add_version_index
ran DROP INDEX before confirming recreation; WAL checkpointing
failed midway.
09:35 Incident declared P1; customer comms drafted ▶
Who
@dean (eng lead)
Action taken
Status page updated; affected users notified by email
09:48 Clean backup from 08:50 UTC identified ▶
Who
@priya
Action taken
Began restore for 47 affected accounts individually — no bulk
restore tooling available
10:15 Ad-hoc restore script written and tested ▶
Who
@marco
Action taken
Script copies clean file_versions rows from backup to prod.
Tested on 3 staging accounts; output verified correct.
10:40 Bulk restore started for all 47 accounts ▶
Who
@marco + @priya
Action taken
Monitoring error rate continuously during restore
execution
11:20 All 47 accounts restored; error rate at baseline ▶
Who
@dean
Action taken
Verified each account can access file history via spot
checks
11:32 Incident resolved; all-clear posted on status page ▶
Who
@dean
Action taken
Post-mortem scheduled for 2026-04-17
5 Whys — Root Cause Analysis
1 Why did users lose access to file history? ▶
The
file_versions
table was corrupted during a migration, making all version lookups
fail with a database error.
2 Why was the table corrupted? ▶
Migration
0041_add_version_index
dropped a write-ahead-log index before confirming the replacement
was created. The WAL checkpoint failed midway, leaving the table in
an inconsistent state.
3 Why did the migration run without validation? ▶
The migration script had no rollback guard. It did not check that
the new index existed before proceeding to the DROP statement.
4 Why was there no rollback guard? ▶
Our migration review checklist did not require "verify new object
exists before dropping old." This check existed for column changes
but not index changes — a gap in the checklist introduced when index
migrations were added as a pattern.
5 Why was there no bulk restore tooling? ▶
Database restores have historically been manual (1–2 per quarter).
The time cost of a bulk restore script was deprioritized in
planning. This incident exposed the gap: manual restore at scale
took over an hour that bulk tooling would have compressed to
minutes.
Impact by System
| System | Severity | User-Facing Effect |
|---|---|---|
| File sync | Low | Continued in last-write-wins fallback; no files lost |
| File history / versions | Critical | Unavailable for 47 accounts for 2h 18m |
| Conflict resolution UI | High | Could not resolve conflicts without version history |
| Dashboard | Medium | "File History" tab showed error state for affected accounts |
Action Items
| Description | Owner | Due | Status |
|---|---|---|---|
| Add "verify new object before DROP" to migration review checklist | PR | 2026-04-22 | ✓ Done |
| Build automated migration rollback test harness (run migrations against prod clone in CI) | MA | 2026-05-01 | ✓ Done |
| Write bulk account restore script and add to runbooks | MA | 2026-04-22 | ✓ Done |
| Add SQLite WAL checkpoint health check to monitoring | DE | 2026-04-29 | Open |
| Evaluate migration to Postgres for primary store (eliminates WAL checkpoint failure mode) | DE | 2026-05-30 | Open |