refactor(schema): consolidate schema definition to single source of truth
This commit is contained in:
@@ -15,27 +15,10 @@ import { existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import Database from "better-sqlite3";
|
||||
|
||||
const SCHEMA = `-- .codexis/index.db schema:
|
||||
--
|
||||
-- files: indexed source files
|
||||
-- id INTEGER PRIMARY KEY
|
||||
-- path TEXT NOT NULL UNIQUE -- relative to repo root
|
||||
-- language TEXT NOT NULL -- e.g. 'go', 'typescript', 'python', 'tsx', 'proto'
|
||||
-- package TEXT -- package/module name (from AST or directory)
|
||||
-- hash TEXT NOT NULL -- sha256, for incremental indexing
|
||||
-- indexed_at DATETIME
|
||||
--
|
||||
-- symbols: definitions extracted via tree-sitter
|
||||
-- id INTEGER PRIMARY KEY
|
||||
-- file_id INTEGER NOT NULL REFERENCES files(id)
|
||||
-- name TEXT NOT NULL
|
||||
-- kind TEXT NOT NULL -- one of: 'function','method','class','type','interface','constant','variable','constructor'
|
||||
-- line INTEGER NOT NULL -- 1-indexed
|
||||
-- line_end INTEGER -- end of definition body
|
||||
-- col INTEGER
|
||||
-- col_end INTEGER
|
||||
-- exported BOOLEAN -- language-specific visibility
|
||||
-- parent_id INTEGER REFERENCES symbols(id) -- e.g. method→class, field→struct`;
|
||||
// @ts-expect-error - generated file
|
||||
import schema from "./schema.sql?raw";
|
||||
|
||||
const SCHEMA = schema;
|
||||
|
||||
const DESCRIPTION = `Query the code index database (.codexis/index.db). Run read-only SQL to find symbols, files, and line numbers across the codebase.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user