DROP TABLE IF EXISTS task_runs; CREATE TABLE task_runs ( id TEXT PRIMARY KEY, task_id TEXT NOT NULL, status TEXT CHECK(status IN ('pending','running','failed','success')) NOT NULL DEFAULT 'pending', trigger_mode TEXT CHECK(trigger_mode IN ('manual','webhook','schedule')) NOT NULL DEFAULT 'manual', exit_code INT, logs TEXT, submitted_at DATETIME, started_at DATETIME, ended_at DATETIME );