Files
2026-05-14 00:28:13 +02:00

21 lines
942 B
SQL

-- copied_code: matches de cuerpos de funcion del registry encontrados en apps.
-- Poblado por `call_monitor copied-code` que invoca infra.AuditCopiedCode.
-- Cada fila representa un (app_file, app_function, registry_id) sospechoso.
-- UNIQUE incluye body_hash para que solo se inserte una vez por (path,fn,id,hash).
CREATE TABLE IF NOT EXISTS copied_code (
id INTEGER PRIMARY KEY AUTOINCREMENT,
app_file TEXT NOT NULL,
app_function TEXT NOT NULL,
registry_id TEXT NOT NULL,
body_hash TEXT NOT NULL,
similarity REAL NOT NULL DEFAULT 1.0,
kind TEXT NOT NULL,
detected_at INTEGER NOT NULL,
UNIQUE(app_file, app_function, registry_id, body_hash)
);
CREATE INDEX IF NOT EXISTS idx_copied_registry ON copied_code(registry_id);
CREATE INDEX IF NOT EXISTS idx_copied_kind ON copied_code(kind);
CREATE INDEX IF NOT EXISTS idx_copied_detected ON copied_code(detected_at);