CREATE TABLE IF NOT EXISTS public.resources ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), name text NOT NULL, type text NOT NULL CHECK (type IN ('role','person','system','equipment','supply')), cost_per_hour numeric NOT NULL DEFAULT 0, created_by uuid REFERENCES public.users(id), updated_by uuid REFERENCES public.users(id), created_at timestamptz NOT NULL DEFAULT now(), updated_at timestamptz NOT NULL DEFAULT now() ); ALTER TABLE public.resources ENABLE ROW LEVEL SECURITY; CREATE POLICY "all_resources" ON public.resources FOR ALL USING (auth.uid() IS NOT NULL) WITH CHECK (auth.uid() IS NOT NULL);