Current state
Any hub user still on the old issue_links/general schema loses all task and comment history the moment they upgrade, because migrate_consolidate_links_and_kind in store/src/tasks.rs detects the old schema and immediately executes DROP TABLE IF EXISTS task_comments followed by DROP TABLE IF EXISTS tasks. The inline comment justifying this is "All data is test data — drop and regenerate is safe", but this migration runs in production on every hub startup against real task data.
Ideal state
- The migration to the new schema preserves existing task and comment rows using an additive strategy (e.g.,
ALTER TABLE … ADD COLUMN, renaming values in-place, or inserting from the old table into a new schema then dropping the original)
- No existing task or comment row is deleted as a side-effect of a version upgrade
- A rollback to the previous binary does not require re-running a migration to restore lost rows
Out of scope
- Rewriting other migrations in
store/src/tasks.rs
- Changing the task or comment schema beyond what is necessary to preserve existing data during the transition
Starting points
store/src/tasks.rs — lines 46–76: migrate_consolidate_links_and_kind, specifically the DROP TABLE IF EXISTS task_comments and DROP TABLE IF EXISTS tasks calls
QA plan
- Create a hub SQLite database with a row in the old
tasks table (with issue_links and general columns populated).
- Run hub with the current code and open the database — expect the task row and any associated comment rows to still be present after migration.
- Inspect the migration path in
store/src/tasks.rs — expect no unconditional DROP TABLE calls on tasks or task_comments.
Done when
Any existing task and comment row survives a migration from the old issue_links/general schema to the new schema without being silently dropped.
Current state
Any hub user still on the old
issue_links/generalschema loses all task and comment history the moment they upgrade, becausemigrate_consolidate_links_and_kindinstore/src/tasks.rsdetects the old schema and immediately executesDROP TABLE IF EXISTS task_commentsfollowed byDROP TABLE IF EXISTS tasks. The inline comment justifying this is "All data is test data — drop and regenerate is safe", but this migration runs in production on every hub startup against real task data.Ideal state
ALTER TABLE … ADD COLUMN, renaming values in-place, or inserting from the old table into a new schema then dropping the original)Out of scope
store/src/tasks.rsStarting points
store/src/tasks.rs— lines 46–76:migrate_consolidate_links_and_kind, specifically theDROP TABLE IF EXISTS task_commentsandDROP TABLE IF EXISTS taskscallsQA plan
taskstable (withissue_linksandgeneralcolumns populated).store/src/tasks.rs— expect no unconditionalDROP TABLEcalls ontasksortask_comments.Done when
Any existing task and comment row survives a migration from the old
issue_links/generalschema to the new schema without being silently dropped.