
INSERT INTO storage.buckets (id, name, public) VALUES ('investor-files', 'investor-files', true)
ON CONFLICT (id) DO NOTHING;

CREATE POLICY "Public can view investor files"
ON storage.objects FOR SELECT
USING (bucket_id = 'investor-files');

CREATE POLICY "Staff can upload investor files"
ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (bucket_id = 'investor-files' AND is_staff(auth.uid()));

CREATE POLICY "Staff can update investor files"
ON storage.objects FOR UPDATE
TO authenticated
USING (bucket_id = 'investor-files' AND is_staff(auth.uid()));

CREATE POLICY "Staff can delete investor files"
ON storage.objects FOR DELETE
TO authenticated
USING (bucket_id = 'investor-files' AND is_staff(auth.uid()));
