Files
glass/supabase/migrations/003_order_photos_bucket.sql
T
2026-05-10 17:23:10 +03:00

23 lines
700 B
SQL

-- Create storage bucket for order photos
-- Run in Supabase SQL Editor
INSERT INTO storage.buckets (id, name, public)
VALUES ('order-photos', 'order-photos', true)
ON CONFLICT (id) DO NOTHING;
-- Allow authenticated users to upload
CREATE POLICY "Authenticated users can upload order photos"
ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (bucket_id = 'order-photos');
-- Allow authenticated users to delete own uploads
CREATE POLICY "Authenticated users can delete order photos"
ON storage.objects FOR DELETE
TO authenticated
USING (bucket_id = 'order-photos');
-- Public read
CREATE POLICY "Public read order photos"
ON storage.objects FOR SELECT
USING (bucket_id = 'order-photos');