Automated_Journal_VimWiki/scripts/utils/task-db.sql
2023-08-29 12:01:57 -05:00

15 lines
533 B
SQL

CREATE TABLE IF NOT EXISTS tasks (
TASK_ID INTEGER PRIMARY KEY AUTOINCREMENT,
TASK_TITLE TEXT NOT NULL,
TASK_CREATION_DATE DATETIME DEFAULT CURRENT_TIMESTAMP,
TASK_DUE_DATE DATETIME DEFAULT DATETIME(CURRENT_TIMESTAMP, '+7 day')
);
CREATE VIEW tasks_by_creation AS
SELECT TASK_ID task_number, TASK_TITLE task_title, DATE(TASK_CREATION_DATE) creation_date FROM tasks
ORDER BY TASK_CREATION_DATE ASC;
CREATE VIEW tasks_by_duedate AS
SELECT TASK_ID task_number, TASK_TITLE task_title FROM tasks
ORDER BY TASK_DUE_DATE ASC;