feat(database): add file size metadata and range parameters

- Add byte_size and line_count columns to files table
- Increment SchemaVersion to 2 (requires re-indexing)
- Add DeclarationWithMetadata, FileRange, FileResult types
- Add GetDeclarationsWithMetadata method for file metadata lookup
- Add GetFileWithRange method for paginated file retrieval
- Implement countLines and applyLineRange helpers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 01:30:39 +01:00
parent 128cc313dc
commit d9aab773c6
4 changed files with 226 additions and 19 deletions

View File

@@ -2,7 +2,7 @@ package database
// SchemaVersion is the current database schema version.
// When this changes, the database will be dropped and recreated.
const SchemaVersion = 1
const SchemaVersion = 2
// Common SQL statements shared between implementations.
const (
@@ -53,7 +53,9 @@ const (
revision_id INTEGER NOT NULL REFERENCES revisions(id) ON DELETE CASCADE,
file_path TEXT NOT NULL,
extension TEXT,
content TEXT NOT NULL
content TEXT NOT NULL,
byte_size INTEGER NOT NULL DEFAULT 0,
line_count INTEGER NOT NULL DEFAULT 0
)`
)