46 lines
1.6 KiB
SQL
46 lines
1.6 KiB
SQL
PRAGMA foreign_keys = ON;
|
|
|
|
CREATE TABLE projects (
|
|
id BLOB PRIMARY KEY,
|
|
name TEXT NOT NULL,
|
|
git_repo_path TEXT NOT NULL DEFAULT '' UNIQUE,
|
|
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE TABLE tasks (
|
|
id BLOB PRIMARY KEY,
|
|
project_id BLOB NOT NULL,
|
|
title TEXT NOT NULL,
|
|
description TEXT,
|
|
status TEXT NOT NULL DEFAULT 'todo'
|
|
CHECK (status IN ('todo','inprogress','done','cancelled','inreview')),
|
|
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
|
|
);
|
|
|
|
CREATE TABLE task_attempts (
|
|
id BLOB PRIMARY KEY,
|
|
task_id BLOB NOT NULL,
|
|
worktree_path TEXT NOT NULL,
|
|
base_commit TEXT,
|
|
merge_commit TEXT,
|
|
executor TEXT,
|
|
stdout TEXT,
|
|
stderr TEXT,
|
|
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE
|
|
);
|
|
|
|
CREATE TABLE task_attempt_activities (
|
|
id BLOB PRIMARY KEY,
|
|
task_attempt_id BLOB NOT NULL,
|
|
status TEXT NOT NULL DEFAULT 'init'
|
|
CHECK (status IN ('init','inprogress','paused')),
|
|
note TEXT,
|
|
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (task_attempt_id) REFERENCES task_attempts(id) ON DELETE CASCADE
|
|
);
|