CREATE TABLE IF NOT EXISTS service_ping_history (
  id SERIAL PRIMARY KEY,
  service_id VARCHAR(255) NOT NULL,
  status VARCHAR(50) NOT NULL,
  response_time_ms INTEGER,
  checked_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_sph_service_checked ON service_ping_history(service_id, checked_at DESC);
