fix(kanban): move session_id index creation from SCHEMA_SQL to migration#28562
Closed
kungunier wants to merge 1 commit into
Closed
fix(kanban): move session_id index creation from SCHEMA_SQL to migration#28562kungunier wants to merge 1 commit into
kungunier wants to merge 1 commit into
Conversation
The CREATE INDEX IF NOT EXISTS on tasks(session_id) in SCHEMA_SQL runs before _migrate_add_optional_columns(), causing a 'sqlite3.OperationalError: no such column: session_id' crash on existing kanban.db files created by older Hermes versions. The index creation is already handled correctly inside _migrate_add_optional_columns() (line 1166-1178) where the ALTER TABLE ADD COLUMN runs first. Remove the premature copy. Fixes #28554
16f14b3 to
60165a7
Compare
Collaborator
This was referenced May 19, 2026
Collaborator
|
Thanks @kungunier — closing as duplicate of #28781, which combined all six community PRs that hit this bug on 2026-05-19 into one salvage (merged in 7552e0f). You correctly diagnosed the SCHEMA_SQL-before-migration ordering issue. The salvage extends coverage to all four additive-column indexes ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When upgrading from an older Hermes version to v0.14.0, existing kanban.db files lack the
session_idcolumn.SCHEMA_SQLincludes:CREATE TABLE IF NOT EXISTSis a no-op on existing tables (old schema, nosession_id). But theCREATE INDEXon the next line referencessession_idbefore_migrate_add_optional_columns()gets a chance to add it viaALTER TABLE. Crash.Fix
Remove the premature
CREATE INDEXfromSCHEMA_SQL. The index creation is already handled correctly inside_migrate_add_optional_columns()(line 1166–1178), whereALTER TABLE ADD COLUMNruns first.One line deleted, no logic changed — the index still gets created, just at the right time.
Verification
SCHEMA_SQLcreates table + all columns → migration is a no-op → index created during migration ✓SCHEMA_SQLno-ops on existing table → migration addssession_idcolumn → migration creates index ✓Fixes #28554