Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-24 03:32:21 +00:00
co-authored by renee-png
parent 4d87143beb
commit 5924f3f4b7
2 changed files with 24 additions and 0 deletions
@@ -0,0 +1,21 @@
ALTER TABLE public.incoming_emails
ADD COLUMN IF NOT EXISTS attachments jsonb NOT NULL DEFAULT '[]'::jsonb;
INSERT INTO storage.buckets (id, name, public)
VALUES ('email-attachments', 'email-attachments', false)
ON CONFLICT (id) DO NOTHING;
CREATE POLICY "email_attachments_select_auth"
ON storage.objects FOR SELECT
TO authenticated
USING (bucket_id = 'email-attachments');
CREATE POLICY "email_attachments_insert_auth"
ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (bucket_id = 'email-attachments');
CREATE POLICY "email_attachments_delete_admin"
ON storage.objects FOR DELETE
TO authenticated
USING (bucket_id = 'email-attachments' AND public.is_admin(auth.uid()));