Files
acmcc/supabase/migrations/20260417221115_d36ee5a9-a750-41c4-8c8a-e0373a2ad87a.sql
2026-06-01 20:19:26 -04:00

29 lines
1.0 KiB
SQL

-- Add attachment URL column to calendar_events
ALTER TABLE public.calendar_events
ADD COLUMN IF NOT EXISTS attachment_url text,
ADD COLUMN IF NOT EXISTS attachment_name text;
-- Create public bucket for calendar attachments (meeting notices, etc.)
INSERT INTO storage.buckets (id, name, public)
VALUES ('calendar-attachments', 'calendar-attachments', true)
ON CONFLICT (id) DO NOTHING;
-- Storage policies
CREATE POLICY "Calendar attachments are publicly viewable"
ON storage.objects FOR SELECT
USING (bucket_id = 'calendar-attachments');
CREATE POLICY "Authenticated users can upload calendar attachments"
ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (bucket_id = 'calendar-attachments');
CREATE POLICY "Authenticated users can update calendar attachments"
ON storage.objects FOR UPDATE
TO authenticated
USING (bucket_id = 'calendar-attachments');
CREATE POLICY "Authenticated users can delete calendar attachments"
ON storage.objects FOR DELETE
TO authenticated
USING (bucket_id = 'calendar-attachments');