CREATE TABLE IF NOT EXISTS boss_state_snapshots (
  snapshot_key TEXT PRIMARY KEY,
  state JSONB NOT NULL,
  created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
  updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);

CREATE INDEX IF NOT EXISTS boss_state_snapshots_updated_at_idx
  ON boss_state_snapshots (updated_at DESC);
