-- Cron health monitoring state
CREATE TABLE IF NOT EXISTS scheduler_state (
    id INTEGER PRIMARY KEY CHECK (id = 1),
    last_run_at TEXT NOT NULL,
    last_success_at TEXT,
    last_error TEXT,
    last_alert_at TEXT,
    updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);

INSERT OR IGNORE INTO scheduler_state
    (id, last_run_at, last_success_at, last_error, last_alert_at, updated_at)
VALUES
    (1, datetime('now'), NULL, NULL, NULL, datetime('now'));
