-- Safety canary table for /ops/v1/summary
CREATE TABLE IF NOT EXISTS ops_safety_canary (
  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  occurred_at timestamptz NOT NULL DEFAULT now(),
  allergen_invariant_brott integer NOT NULL DEFAULT 0,
  overifierade_visade integer NOT NULL DEFAULT 0,
  food_safety_lint_avvisade_7d integer,
  computed_at timestamptz NOT NULL DEFAULT now()
);

CREATE INDEX IF NOT EXISTS ops_safety_canary_occurred_idx
  ON ops_safety_canary (occurred_at DESC);
