
CREATE TABLE public.board_members (
  id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
  association_id UUID REFERENCES public.associations(id) ON DELETE CASCADE NOT NULL,
  member_name TEXT NOT NULL,
  member_email TEXT,
  phone TEXT,
  role TEXT DEFAULT 'Member',
  approval_authority BOOLEAN NOT NULL DEFAULT false,
  created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
  updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);

ALTER TABLE public.board_members ENABLE ROW LEVEL SECURITY;

CREATE POLICY "Authenticated users can view board_members"
  ON public.board_members FOR SELECT TO authenticated USING (true);

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

CREATE POLICY "Authenticated users can update board_members"
  ON public.board_members FOR UPDATE TO authenticated USING (true) WITH CHECK (true);

CREATE POLICY "Authenticated users can delete board_members"
  ON public.board_members FOR DELETE TO authenticated USING (true);
