CREATE TABLE public.releves (
  id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
  resource text NOT NULL,
  valeur numeric NOT NULL,
  releve_at timestamptz NOT NULL DEFAULT now(),
  note text,
  created_at timestamptz NOT NULL DEFAULT now()
);
GRANT ALL ON public.releves TO service_role;
ALTER TABLE public.releves ENABLE ROW LEVEL SECURITY;
CREATE INDEX releves_resource_date_idx ON public.releves (resource, releve_at);