domain-level constraints
This commit is contained in:
@@ -81,14 +81,15 @@ CREATE TABLE IF NOT EXISTS combination_scores (
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS combination_results (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
combination_id INTEGER NOT NULL REFERENCES combinations(id),
|
||||
domain_id INTEGER NOT NULL REFERENCES domains(id),
|
||||
composite_score REAL,
|
||||
novelty_flag TEXT,
|
||||
llm_review TEXT,
|
||||
human_notes TEXT,
|
||||
pass_reached INTEGER,
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
combination_id INTEGER NOT NULL REFERENCES combinations(id),
|
||||
domain_id INTEGER NOT NULL REFERENCES domains(id),
|
||||
composite_score REAL,
|
||||
novelty_flag TEXT,
|
||||
llm_review TEXT,
|
||||
human_notes TEXT,
|
||||
pass_reached INTEGER,
|
||||
domain_block_reason TEXT,
|
||||
UNIQUE(combination_id, domain_id)
|
||||
);
|
||||
|
||||
@@ -109,6 +110,14 @@ CREATE TABLE IF NOT EXISTS pipeline_runs (
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS domain_constraints (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
domain_id INTEGER NOT NULL REFERENCES domains(id),
|
||||
key TEXT NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
UNIQUE(domain_id, key, value)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_deps_entity ON dependencies(entity_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_deps_category_key ON dependencies(category, key);
|
||||
CREATE INDEX IF NOT EXISTS idx_combo_status ON combinations(status);
|
||||
@@ -126,6 +135,26 @@ def _migrate(conn: sqlite3.Connection) -> None:
|
||||
"ALTER TABLE domain_metric_weights ADD COLUMN lower_is_better INTEGER NOT NULL DEFAULT 0"
|
||||
)
|
||||
|
||||
# Create domain_constraints table if missing (added after initial schema)
|
||||
tables = {r[0] for r in conn.execute(
|
||||
"SELECT name FROM sqlite_master WHERE type='table'"
|
||||
).fetchall()}
|
||||
if "domain_constraints" not in tables:
|
||||
conn.execute("""CREATE TABLE IF NOT EXISTS domain_constraints (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
domain_id INTEGER NOT NULL REFERENCES domains(id),
|
||||
key TEXT NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
UNIQUE(domain_id, key, value)
|
||||
)""")
|
||||
|
||||
# Add domain_block_reason to combination_results if missing
|
||||
result_cols = {r[1] for r in conn.execute("PRAGMA table_info(combination_results)").fetchall()}
|
||||
if "domain_block_reason" not in result_cols:
|
||||
conn.execute(
|
||||
"ALTER TABLE combination_results ADD COLUMN domain_block_reason TEXT"
|
||||
)
|
||||
|
||||
# Backfill: cost_efficiency is lower-is-better in all domains
|
||||
conn.execute(
|
||||
"""UPDATE domain_metric_weights SET lower_is_better = 1
|
||||
|
||||
Reference in New Issue
Block a user