kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 17:26:31 +02:00
parent 17d7806838
commit eab9e951ab
12 changed files with 1696 additions and 5 deletions

View file

@ -29,6 +29,10 @@ CREATE TABLE IF NOT EXISTS projects (
ssh_key_path TEXT,
ssh_proxy_jump TEXT,
description TEXT,
deploy_host TEXT,
deploy_path TEXT,
deploy_runtime TEXT,
deploy_restart_cmd TEXT,
autocommit_enabled INTEGER DEFAULT 0,
obsidian_vault_path TEXT,
worktrees_enabled INTEGER DEFAULT 0,
@ -302,6 +306,18 @@ CREATE TABLE IF NOT EXISTS task_attachments (
);
CREATE INDEX IF NOT EXISTS idx_task_attachments_task ON task_attachments(task_id);
-- Live console log (KIN-084)
CREATE TABLE IF NOT EXISTS pipeline_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
pipeline_id INTEGER NOT NULL REFERENCES pipelines(id),
ts TEXT NOT NULL DEFAULT (datetime('now')),
level TEXT NOT NULL DEFAULT 'INFO',
message TEXT NOT NULL,
extra_json TEXT
);
CREATE INDEX IF NOT EXISTS idx_pipeline_log_pipeline_id ON pipeline_log(pipeline_id, id);
"""
@ -419,6 +435,22 @@ def _migrate(conn: sqlite3.Connection):
conn.execute("ALTER TABLE projects ADD COLUMN description TEXT")
conn.commit()
if "deploy_host" not in proj_cols:
conn.execute("ALTER TABLE projects ADD COLUMN deploy_host TEXT")
conn.commit()
if "deploy_path" not in proj_cols:
conn.execute("ALTER TABLE projects ADD COLUMN deploy_path TEXT")
conn.commit()
if "deploy_runtime" not in proj_cols:
conn.execute("ALTER TABLE projects ADD COLUMN deploy_runtime TEXT")
conn.commit()
if "deploy_restart_cmd" not in proj_cols:
conn.execute("ALTER TABLE projects ADD COLUMN deploy_restart_cmd TEXT")
conn.commit()
# Migrate audit_log + project_phases tables
existing_tables = {r[0] for r in conn.execute(
"SELECT name FROM sqlite_master WHERE type='table'"
@ -612,6 +644,20 @@ def _migrate(conn: sqlite3.Connection):
""")
conn.commit()
if "pipeline_log" not in existing_tables:
conn.executescript("""
CREATE TABLE IF NOT EXISTS pipeline_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
pipeline_id INTEGER NOT NULL REFERENCES pipelines(id),
ts TEXT NOT NULL DEFAULT (datetime('now')),
level TEXT NOT NULL DEFAULT 'INFO',
message TEXT NOT NULL,
extra_json TEXT
);
CREATE INDEX IF NOT EXISTS idx_pipeline_log_pipeline_id ON pipeline_log(pipeline_id, id);
""")
conn.commit()
# Migrate pipelines: add parent_pipeline_id and department columns (KIN-098)
# Guard: table may not exist in legacy schemas without pipelines (old test fixtures)
if "pipelines" in existing_tables: