-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup-storage-quick.sql
More file actions
30 lines (24 loc) · 1.11 KB
/
Copy pathsetup-storage-quick.sql
File metadata and controls
30 lines (24 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- Quick setup for Supabase Storage
-- Run this in your Supabase SQL Editor
-- Create the event-media bucket
INSERT INTO storage.buckets (id, name, public, file_size_limit, allowed_mime_types)
VALUES (
'event-media',
'event-media',
true,
5242880, -- 5MB limit
ARRAY['image/jpeg', 'image/jpg', 'image/png', 'image/webp']
) ON CONFLICT (id) DO NOTHING;
-- Enable RLS for storage.objects
ALTER TABLE storage.objects ENABLE ROW LEVEL SECURITY;
-- Create policies for event-media bucket
-- Public read access
CREATE POLICY "Public read access for event media" ON storage.objects
FOR SELECT USING (bucket_id = 'event-media');
-- Admin write access (service role)
CREATE POLICY "Admin write access for event media" ON storage.objects
FOR INSERT WITH CHECK (bucket_id = 'event-media' AND auth.role() = 'service_role');
CREATE POLICY "Admin update access for event media" ON storage.objects
FOR UPDATE USING (bucket_id = 'event-media' AND auth.role() = 'service_role');
CREATE POLICY "Admin delete access for event media" ON storage.objects
FOR DELETE USING (bucket_id = 'event-media' AND auth.role() = 'service_role');