2022-08-20 15:42:20 +03:00
|
|
|
CREATE TABLE _tas_info (
|
|
|
|
version INTEGER PRIMARY KEY
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE tasks (
|
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
project TEXT ,
|
|
|
|
link TEXT ,
|
|
|
|
dir_path TEXT ,
|
2022-08-26 23:19:37 +03:00
|
|
|
uuid BLOB ,
|
2022-08-20 15:42:20 +03:00
|
|
|
|
|
|
|
current BOOLEAN NOT NULL DEFAULT false,
|
|
|
|
|
|
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
finished_at DATETIME
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE VIEW active_tasks
|
|
|
|
AS
|
|
|
|
SELECT
|
|
|
|
t.*,
|
|
|
|
row_number() OVER (ORDER BY t.created_at) AS idx
|
|
|
|
FROM tasks AS t
|
|
|
|
WHERE t.finished_at IS NULL
|
|
|
|
ORDER BY t.created_at
|
|
|
|
;
|
2022-08-20 16:45:45 +03:00
|
|
|
|
|
|
|
CREATE VIEW finished_tasks
|
|
|
|
AS
|
|
|
|
SELECT
|
|
|
|
t.*,
|
|
|
|
row_number() OVER (ORDER BY t.finished_at DESC) AS idx
|
|
|
|
FROM tasks AS t
|
|
|
|
WHERE t.finished_at IS NOT NULL
|
|
|
|
ORDER BY t.finished_at DESC
|
|
|
|
;
|