CREATE TABLE IF NOT EXISTS postgres_monitor_snapshot (
    id TEXT PRIMARY KEY,
    collected_at TEXT NOT NULL,
    payload_json TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS postgres_maintenance_audit (
    id TEXT PRIMARY KEY,
    tenant_id TEXT,
    actor_prefix TEXT,
    kind TEXT NOT NULL,
    target_table TEXT,
    dry_run INTEGER NOT NULL DEFAULT 0,
    status TEXT NOT NULL,
    detail_json TEXT,
    error_message TEXT,
    created_at TEXT NOT NULL,
    started_at TEXT,
    finished_at TEXT
);
