-- Historique des métriques (série temporelle) -- Alimenté à chaque push agent, rétention 7 jours (purge automatique) CREATE TABLE IF NOT EXISTS metrics_history ( id INTEGER PRIMARY KEY AUTOINCREMENT, agent_id TEXT NOT NULL, timestamp TEXT NOT NULL, cpu_percent REAL, ram_percent REAL, disk_percent REAL, temperature_c REAL, net_rx_bps INTEGER, net_tx_bps INTEGER ); CREATE INDEX IF NOT EXISTS idx_mh_agent_ts ON metrics_history(agent_id, timestamp DESC);