CREATE TABLE system_schedules ( id TEXT PRIMARY KEY, schedule TEXT NOT NULL, next_run_at TEXT NOT NULL, last_run_at TEXT ) STRICT; -- Seed the fixed set of system schedules. The schedule column is authoritative -- thereafter; the runner holds only the id->task dispatch. next_run_at is set -- to now so each fires once on first boot after this migration, then settles -- onto its schedule. INSERT INTO system_schedules (id, schedule, next_run_at) VALUES ('prune_sessions', 'daily 03:00', datetime('now')), ('prune_tokens', 'daily 04:00', datetime('now'));