kin: auto-commit after pipeline
This commit is contained in:
parent
04cbbc563b
commit
b6f40a6ace
9 changed files with 1690 additions and 16 deletions
48
core/db.py
48
core/db.py
|
|
@ -140,10 +140,29 @@ CREATE TABLE IF NOT EXISTS pipelines (
|
|||
total_cost_usd REAL,
|
||||
total_tokens INTEGER,
|
||||
total_duration_seconds INTEGER,
|
||||
parent_pipeline_id INTEGER REFERENCES pipelines(id),
|
||||
department TEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
completed_at DATETIME
|
||||
);
|
||||
|
||||
-- Межотдельные handoff-ы (KIN-098)
|
||||
CREATE TABLE IF NOT EXISTS department_handoffs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
pipeline_id INTEGER NOT NULL REFERENCES pipelines(id),
|
||||
task_id TEXT NOT NULL REFERENCES tasks(id),
|
||||
from_department TEXT NOT NULL,
|
||||
to_department TEXT,
|
||||
artifacts JSON,
|
||||
decisions_made JSON,
|
||||
blockers JSON,
|
||||
status TEXT DEFAULT 'pending',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_handoffs_pipeline ON department_handoffs(pipeline_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_handoffs_task ON department_handoffs(task_id);
|
||||
|
||||
-- Post-pipeline хуки
|
||||
CREATE TABLE IF NOT EXISTS hooks (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
|
@ -591,6 +610,35 @@ def _migrate(conn: sqlite3.Connection):
|
|||
""")
|
||||
conn.commit()
|
||||
|
||||
# Migrate pipelines: add parent_pipeline_id and department columns (KIN-098)
|
||||
pipeline_cols = {r[1] for r in conn.execute("PRAGMA table_info(pipelines)").fetchall()}
|
||||
if "parent_pipeline_id" not in pipeline_cols:
|
||||
conn.execute("ALTER TABLE pipelines ADD COLUMN parent_pipeline_id INTEGER REFERENCES pipelines(id)")
|
||||
conn.commit()
|
||||
if "department" not in pipeline_cols:
|
||||
conn.execute("ALTER TABLE pipelines ADD COLUMN department TEXT")
|
||||
conn.commit()
|
||||
|
||||
# Create department_handoffs table (KIN-098)
|
||||
if "department_handoffs" not in existing_tables:
|
||||
conn.executescript("""
|
||||
CREATE TABLE IF NOT EXISTS department_handoffs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
pipeline_id INTEGER NOT NULL REFERENCES pipelines(id),
|
||||
task_id TEXT NOT NULL REFERENCES tasks(id),
|
||||
from_department TEXT NOT NULL,
|
||||
to_department TEXT,
|
||||
artifacts JSON,
|
||||
decisions_made JSON,
|
||||
blockers JSON,
|
||||
status TEXT DEFAULT 'pending',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_handoffs_pipeline ON department_handoffs(pipeline_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_handoffs_task ON department_handoffs(task_id);
|
||||
""")
|
||||
conn.commit()
|
||||
|
||||
# Rename legacy 'auto' → 'auto_complete' (KIN-063)
|
||||
conn.execute(
|
||||
"UPDATE projects SET execution_mode = 'auto_complete' WHERE execution_mode = 'auto'"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue