-- Make email-images bucket public so embedded images render in email clients
UPDATE storage.buckets SET public = true WHERE id = 'email-images';

-- Public read policy for email-images
DROP POLICY IF EXISTS "Public can read email images" ON storage.objects;
CREATE POLICY "Public can read email images"
ON storage.objects FOR SELECT
USING (bucket_id = 'email-images');

-- Authenticated users can upload email images
DROP POLICY IF EXISTS "Authenticated can upload email images" ON storage.objects;
CREATE POLICY "Authenticated can upload email images"
ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (bucket_id = 'email-images');