-- Completed tasks log
CREATE TABLE IF NOT EXISTS completed_tasks (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    source TEXT NOT NULL,           -- 'todoist', 'trello', 'gtasks', 'bug'
    source_id TEXT NOT NULL,        -- original ID from source
    title TEXT NOT NULL,
    due_date TEXT,                  -- original due date
    completed_at TEXT NOT NULL DEFAULT (datetime('now', 'localtime')),
    UNIQUE(source, source_id)
);

CREATE INDEX IF NOT EXISTS idx_completed_tasks_completed_at ON completed_tasks(completed_at);
