""" Migration: add watcher_agents table. Safe to run multiple times (idempotent). """ import sqlite3 import os DB_PATH = os.path.join(os.path.dirname(__file__), "data", "seismo.db") def migrate(): con = sqlite3.connect(DB_PATH) cur = con.cursor() cur.execute(""" CREATE TABLE IF NOT EXISTS watcher_agents ( id TEXT PRIMARY KEY, source_type TEXT NOT NULL, version TEXT, last_seen DATETIME, status TEXT NOT NULL DEFAULT 'unknown', ip_address TEXT, log_tail TEXT, update_pending INTEGER NOT NULL DEFAULT 0, update_version TEXT ) """) con.commit() con.close() print("Migration complete: watcher_agents table ready.") if __name__ == "__main__": migrate()