feat: add SQLite database and persistent task schema

This commit is contained in:
Mpho10111
2026-08-11 20:51:10 +02:00
parent 77fe7cfdac
commit 63833efb7a
4 changed files with 76 additions and 0 deletions

17
db/schema.sql Normal file
View File

@@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS tasks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL CHECK (length(trim(title)) > 0),
description TEXT NOT NULL DEFAULT '',
due_date TEXT NOT NULL CHECK (due_date GLOB '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]'),
topic TEXT NOT NULL CHECK (length(trim(topic)) > 0),
status TEXT NOT NULL DEFAULT 'Todo' CHECK (status IN ('Todo', 'In-Progress', 'Complete')),
archived_at TEXT,
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_tasks_active_status
ON tasks (archived_at, status, due_date);
CREATE INDEX IF NOT EXISTS idx_tasks_topic
ON tasks (topic COLLATE NOCASE);