tas/database/migrations/202208162308.sql
Dmitriy Pleshevskiy 78cbc633c4
repo/sqlite: add task struct
- repo/sqlite: add method to get active tasks
2022-08-19 18:02:21 +03:00

24 lines
526 B
SQL

CREATE TABLE _tas_info (
version INTEGER PRIMARY KEY
);
CREATE TABLE tasks (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
project TEXT NULL,
link TEXT NULL,
dir_path TEXT NULL,
current BOOLEAN NOT NULL DEFAULT false,
created_at DATETIME NOT NULL DEFAULT datetime('now'),
finished_at DATETIME NULL
);
CREATE VIEW active_tasks AS (
SELECT t.*
FROM tasks AS t
WHERE t.finished_at IS NULL
ORDER BY t.created_at
);
;