fix(watch): use global index DB with schema migrations - #498
Merged
Merged
Conversation
'cora watch' was opening a project-local SQLite database at
.cora/index.db without running schema migrations, causing a crash
('no such table: projects') on any project that had not been indexed
before.
Fix: use index::open_global_index() (which runs migrations) instead
of manually opening a project-local DB. Also resolve project root
via index::resolve_project_root() for consistency with other commands,
and expand the file-extension filter to cover all tree-sitter supported
languages (php, scala, cs, kt, svelte, jsx, tsx).
This was referenced Aug 5, 2026
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.
What
Fix
cora watchcrash on projects without prior index (no such table: projects).Why
cora watchopened a project-local SQLite database at.cora/index.dbinstead of the global database at~/.codecora/cora-code/cora.db. The project-local DB never hadrun_migrations()called, so theprojectstable (and all other schema) was missing.Every other command (
index,explore,callers,dead-code, etc.) usesindex::open_global_index()which callsschema::run_migrations().cora watchwas the only command that bypassed this.How
Connection::open(project_root.join(".cora/index.db"))→index::open_global_index()index::resolve_project_root()inmain.rsfor consistency withcora indexand other commandsphp,scala,cs,kt,svelte,jsx,tsxtodetect_changes()extension list to match all tree-sitter supported languagesTesting
cargo test --features tree-sitter— 903 tests, 0 failurescargo clippy --all-targets --features tree-sitter -- -D warnings— 0 warningscargo fmt --all -- --check— cleancora watchon Uteke (Rust, 410 symbols/34 files) — no crashcora watchon Corin (Tauri/Svelte/TS) — no crashRelated Issues
Discovered during pre-release validation of v0.13.0.
Checklist