fix(kanban): remove duplicate idx_tasks_session_id from SCHEMA_SQL#28620
Closed
vanhci wants to merge 1 commit into
Closed
fix(kanban): remove duplicate idx_tasks_session_id from SCHEMA_SQL#28620vanhci wants to merge 1 commit into
vanhci wants to merge 1 commit into
Conversation
Collaborator
5 tasks
Collaborator
|
Thanks @vanhci — 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.
Fix: Remove duplicate
idx_tasks_session_idfromSCHEMA_SQLIssue: #28617
Root Cause
When the kanban schema gains a new indexed column (
session_idin thetaskstable), theCREATE INDEX IF NOT EXISTSstatement insideSCHEMA_SQLreferences the new column — but on existing databases, that column doesn't exist yet. SQLite throwsOperationalError: no such column: session_idduringconn.executescript(SCHEMA_SQL)inconnect(), before_migrate_add_optional_columns()gets a chance to add the column.IF NOT EXISTSonly skips if the index exists — SQLite still validates the column reference. On an existing DB withoutsession_id, this fails before the migration code runs.Fix
Remove the
CREATE INDEX IF NOT EXISTS idx_tasks_session_id ON tasks(session_id);fromSCHEMA_SQL. The migration function_migrate_add_optional_columns()already adds both the column and the index correctly for legacy databases.This is consistent with how
run_idontask_eventsis handled — theidx_events_runindex lives only in the migration function, not inSCHEMA_SQL.Verification
idx_tasks_session_idnow only appears once, in_migrate_add_optional_columns()(line ~1176)idx_tasks_session_idno longer appears inSCHEMA_SQL