generated from coulomb/repo-seed
Milestone 2’s core deterministic scanner path
This commit is contained in:
@@ -9,6 +9,40 @@ CREATE TABLE IF NOT EXISTS repositories (
|
||||
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS repository_snapshots (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repository_id INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
|
||||
commit_hash TEXT NOT NULL,
|
||||
branch TEXT NOT NULL,
|
||||
source_path TEXT NOT NULL,
|
||||
file_count INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS analysis_runs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repository_id INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
|
||||
snapshot_id INTEGER REFERENCES repository_snapshots(id) ON DELETE SET NULL,
|
||||
status TEXT NOT NULL,
|
||||
started_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
completed_at TEXT,
|
||||
error_message TEXT,
|
||||
scanner_version TEXT NOT NULL DEFAULT 'deterministic-v0.1'
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS observed_facts (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repository_id INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
|
||||
analysis_run_id INTEGER NOT NULL REFERENCES analysis_runs(id) ON DELETE CASCADE,
|
||||
snapshot_id INTEGER REFERENCES repository_snapshots(id) ON DELETE CASCADE,
|
||||
kind TEXT NOT NULL,
|
||||
path TEXT NOT NULL DEFAULT '',
|
||||
name TEXT NOT NULL,
|
||||
value TEXT NOT NULL DEFAULT '',
|
||||
metadata TEXT NOT NULL DEFAULT '{}',
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS approved_abilities (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repository_id INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
|
||||
@@ -52,6 +86,10 @@ CREATE TABLE IF NOT EXISTS approved_evidence (
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_repositories_status ON repositories(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_snapshots_repository ON repository_snapshots(repository_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_analysis_runs_repository ON analysis_runs(repository_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_observed_facts_repository ON observed_facts(repository_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_observed_facts_run ON observed_facts(analysis_run_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_abilities_repository ON approved_abilities(repository_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_capabilities_repository ON approved_capabilities(repository_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_features_repository ON approved_features(repository_id);
|
||||
|
||||
Reference in New Issue
Block a user