···1+-- Task history table for undo functionality
2+CREATE TABLE IF NOT EXISTS task_history (
3+ id INTEGER PRIMARY KEY AUTOINCREMENT,
4+ task_id INTEGER NOT NULL,
5+ operation TEXT NOT NULL, -- 'update', 'delete'
6+ snapshot TEXT NOT NULL, -- JSON snapshot of task before operation
7+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP
8+);
9+10+CREATE INDEX IF NOT EXISTS idx_task_history_task_id ON task_history(task_id);
11+CREATE INDEX IF NOT EXISTS idx_task_history_created_at ON task_history(created_at);