kin: KIN-ARCH-006 Добавить autocommit_enabled и obsidian_vault_path в базовый SCHEMA

This commit is contained in:
Gros Frumos 2026-03-16 09:57:14 +02:00
parent 295a95bc7f
commit 7630736860
4 changed files with 58 additions and 5 deletions

View file

@ -117,6 +117,8 @@ def _slim_task(task: dict) -> dict:
}
if task.get("revise_comment"):
result["revise_comment"] = task["revise_comment"]
if task.get("acceptance_criteria"):
result["acceptance_criteria"] = task["acceptance_criteria"]
return result

View file

@ -29,6 +29,8 @@ CREATE TABLE IF NOT EXISTS projects (
ssh_key_path TEXT,
ssh_proxy_jump TEXT,
description TEXT,
autocommit_enabled INTEGER DEFAULT 0,
obsidian_vault_path TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
@ -56,6 +58,7 @@ CREATE TABLE IF NOT EXISTS tasks (
revise_comment TEXT,
category TEXT DEFAULT NULL,
telegram_sent BOOLEAN DEFAULT 0,
acceptance_criteria TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
@ -290,6 +293,10 @@ def _migrate(conn: sqlite3.Connection):
conn.execute("ALTER TABLE tasks ADD COLUMN telegram_sent BOOLEAN DEFAULT 0")
conn.commit()
if "acceptance_criteria" not in task_cols:
conn.execute("ALTER TABLE tasks ADD COLUMN acceptance_criteria TEXT")
conn.commit()
if "obsidian_vault_path" not in proj_cols:
conn.execute("ALTER TABLE projects ADD COLUMN obsidian_vault_path TEXT")
conn.commit()

View file

@ -197,16 +197,17 @@ def create_task(
forgejo_issue_id: int | None = None,
execution_mode: str | None = None,
category: str | None = None,
acceptance_criteria: str | None = None,
) -> dict:
"""Create a task linked to a project."""
conn.execute(
"""INSERT INTO tasks (id, project_id, title, status, priority,
assigned_role, parent_task_id, brief, spec, forgejo_issue_id,
execution_mode, category)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
execution_mode, category, acceptance_criteria)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
(id, project_id, title, status, priority, assigned_role,
parent_task_id, _json_encode(brief), _json_encode(spec),
forgejo_issue_id, execution_mode, category),
forgejo_issue_id, execution_mode, category, acceptance_criteria),
)
conn.commit()
return get_task(conn, id)