
CREATE TABLE public.bill_comments (
  id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
  bill_id UUID NOT NULL REFERENCES public.bills(id) ON DELETE CASCADE,
  user_id UUID NOT NULL,
  user_name TEXT NOT NULL DEFAULT '',
  comment TEXT NOT NULL,
  created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);

ALTER TABLE public.bill_comments ENABLE ROW LEVEL SECURITY;

CREATE POLICY "Authenticated users can read bill comments"
  ON public.bill_comments FOR SELECT TO authenticated USING (true);

CREATE POLICY "Authenticated users can insert bill comments"
  ON public.bill_comments FOR INSERT TO authenticated WITH CHECK (true);
