feat: migrate index DB to global ~/.codecora/cora-code/graph.db#355
Merged
Conversation
…de/graph.db with project_id scoping BREAKING CHANGE: index database moved from .cora/index.db (per-project) to ~/.codecora/cora-code/graph.db (global). Schema v2 adds projects table with project_id FK on files, symbols, and call_graph tables. All queries now scoped by project_id. - Add data_dir module: resolves ~/.codecora/cora-code/graph.db with CODECORA_DATA_DIR env override - Add schema v2 migration: projects table, project_id FK on files/symbols/call_graph (CASCADE) - Replace open_index()/default_db_path() with open_global_index() returning (Connection, project_id) - Update all index functions (search, index_stats, prune_deleted, find_callers, find_callees, impact_analysis, clear_edges_for_file, store_edges) to accept project_id - Update all CLI commands (Index, Explore, Callers, Impact, Affected) to use global index - Update all MCP tools to use global index with project scoping - Remove dead code (open_index, resolve_project_root) - Add CodeCora Data Directory Standard doc - All 703 tests pass, 0 clippy warnings
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.
Summary
Migrate the symbol index database from per-project ".cora/index.db" to a global shared database at "~/.codecora/cora-code/graph.db" with
project_idforeign key scoping.Changes
Architecture
~/.codecora/cora-code/graph.dbprojectstable withproject_idFK onfiles,symbols,call_graph(CASCADE on delete)ensure_project()Files
src/data_dir.rs~/.codecora/cora-code/graph.db,CODECORA_DATA_DIRenv overridesrc/index/schema.rsget_or_create_project(),delete_project()src/index/mod.rsopen_global_index()→(Connection, i64), all fns acceptproject_idsrc/index/graph.rsfind_callers,find_callees,impact_analysis,store_edges,clear_edges_for_filescoped byproject_idsrc/index/symbols.rssearch,like_search,filter_searchscoped byproject_idsrc/main.rssrc/mcp/tools.rsdocs/standards/Breaking Change
Existing per-project
.cora/index.dbfiles will be ignored — users need to re-index (cora index --rebuild) after upgrade. This is acceptable since the index feature is Phase 2/pre-stable.Validation
cargo check— 0 errors, 0 warningscargo clippy— cleancargo test— 703 passed, 0 failed