Fix migration 28 crash when client_state.data column is absent#70
Merged
lstein merged 2 commits intofeature/multiuserfrom Feb 20, 2026
Merged
Conversation
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix migration for client_state data column
Fix migration 28 crash when Feb 20, 2026
client_state.data column is absent
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.
Migration 28 unconditionally executes
SELECT data FROM client_state WHERE id = 1when upgrading an existing table, but users who ran an older version of migration 21 without thedatacolumn would hitOperationalError: no such column: data.Changes
migration_28.py: Before readingdata, introspect the table schema viaPRAGMA table_info(client_state). If the column is absent, skip data extraction and proceed directly to drop/recreate with the new multi-user schema.tests/test_sqlite_migrator.py: Added two tests:test_migration_28_with_existing_data_column— verifies JSON data is correctly migrated to per-user key-value rows undersystemtest_migration_28_without_data_column— verifies migration completes without error and produces a clean new schema whendatais absentQA Instructions
Run the new tests directly:
To reproduce the original failure: create a
client_statetable with onlyidandupdated_atcolumns (nodata), then runMigration28Callback— before this fix it raisesOperationalError: no such column: data.Merge Plan
This touches the DB migration chain. No schema version bump is needed — the fix is purely defensive logic within migration 28. Safe to merge independently.
Checklist
What's Newcopy (if doing a release after this PR)🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.