Dmitriy Pleshevskiy
eb78dad91a
- [x] Deps: add rusqlite - [x] Deps: add time - [x] Add created_at to the domain Task - [x] Add schema and first migration - [x] Check current version and run migration - [x] Implement Repository trait - [x] Add script to migrate from FS implementation Closes #5 Closes #19 Reviewed-on: #20 Co-authored-by: Dmitriy Pleshevskiy <dmitriy@ideascup.me> Co-committed-by: Dmitriy Pleshevskiy <dmitriy@ideascup.me>
26 lines
549 B
SQL
26 lines
549 B
SQL
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 ,
|
|
|
|
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
|
|
;
|