markitect-main/migrations/prompts/005_create_changes_and_debt.sql

26 lines
984 B
MySQL
Raw Normal View History

-- Phase 6: Incremental Execution tables
-- artifact_changes: tracks detected changes to artifacts
-- impact_debt: tracks suppressed recomputations
CREATE TABLE IF NOT EXISTS artifact_changes (
id TEXT PRIMARY KEY,
artifact_id TEXT NOT NULL,
old_digest TEXT,
new_digest TEXT NOT NULL,
change_type TEXT NOT NULL,
detected_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_changes_artifact ON artifact_changes(artifact_id);
CREATE INDEX IF NOT EXISTS idx_changes_type ON artifact_changes(change_type);
CREATE TABLE IF NOT EXISTS impact_debt (
id TEXT PRIMARY KEY,
artifact_id TEXT NOT NULL,
dependent_run_id TEXT NOT NULL,
change_magnitude REAL NOT NULL,
suppression_reason TEXT NOT NULL,
recorded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_debt_artifact ON impact_debt(artifact_id);
CREATE INDEX IF NOT EXISTS idx_debt_run ON impact_debt(dependent_run_id);