initial commit: rocket.new export of broadcastbeat
This commit is contained in:
50
supabase/migrations/20260321065000_post_images_storage.sql
Normal file
50
supabase/migrations/20260321065000_post_images_storage.sql
Normal file
@@ -0,0 +1,50 @@
|
||||
-- ============================================================
|
||||
-- Migration: post_images_storage
|
||||
-- Timestamp: 20260321065000
|
||||
-- Creates storage bucket for WordPress imported post images
|
||||
-- ============================================================
|
||||
|
||||
-- 1. Create the storage bucket for post images
|
||||
INSERT INTO storage.buckets (id, name, public, file_size_limit, allowed_mime_types)
|
||||
VALUES (
|
||||
'post-images',
|
||||
'post-images',
|
||||
true,
|
||||
10485760, -- 10MB limit
|
||||
ARRAY['image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml']
|
||||
)
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- 2. RLS Policies for storage.objects (post-images bucket)
|
||||
|
||||
-- Public read access
|
||||
DROP POLICY IF EXISTS "post_images_public_read" ON storage.objects;
|
||||
CREATE POLICY "post_images_public_read"
|
||||
ON storage.objects
|
||||
FOR SELECT
|
||||
TO public
|
||||
USING (bucket_id = 'post-images');
|
||||
|
||||
-- Authenticated users can upload
|
||||
DROP POLICY IF EXISTS "post_images_authenticated_insert" ON storage.objects;
|
||||
CREATE POLICY "post_images_authenticated_insert"
|
||||
ON storage.objects
|
||||
FOR INSERT
|
||||
TO authenticated
|
||||
WITH CHECK (bucket_id = 'post-images');
|
||||
|
||||
-- Authenticated users can update
|
||||
DROP POLICY IF EXISTS "post_images_authenticated_update" ON storage.objects;
|
||||
CREATE POLICY "post_images_authenticated_update"
|
||||
ON storage.objects
|
||||
FOR UPDATE
|
||||
TO authenticated
|
||||
USING (bucket_id = 'post-images');
|
||||
|
||||
-- Authenticated users can delete
|
||||
DROP POLICY IF EXISTS "post_images_authenticated_delete" ON storage.objects;
|
||||
CREATE POLICY "post_images_authenticated_delete"
|
||||
ON storage.objects
|
||||
FOR DELETE
|
||||
TO authenticated
|
||||
USING (bucket_id = 'post-images');
|
||||
Reference in New Issue
Block a user