Files
project-manager/migrations/004_create_todo_items_table.sql
T

12 lines
561 B
SQL
Raw Normal View History

2026-09-03 18:30:52 +01:00
CREATE TABLE IF NOT EXISTS todo_items (
id INTEGER PRIMARY KEY AUTOINCREMENT,
list_id INTEGER NOT NULL REFERENCES todo_lists (id) ON DELETE CASCADE,
text TEXT NOT NULL,
complete INTEGER NOT NULL DEFAULT 0 CHECK (complete IN (0, 1)),
position INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
);
CREATE INDEX IF NOT EXISTS idx_todo_items_list_position ON todo_items (list_id, position);