mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 23:21:08 +02:00
- Integrate worldream (text-first world-building platform) into games/ - Configure as @worldream/web workspace package - Remove standalone git repo, now part of monorepo 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
No EOL
1.2 KiB
SQL
40 lines
No EOL
1.2 KiB
SQL
-- Create storage bucket for content images
|
|
INSERT INTO storage.buckets (id, name, public, file_size_limit, allowed_mime_types)
|
|
VALUES (
|
|
'content-images',
|
|
'content-images',
|
|
true, -- public bucket
|
|
5242880, -- 5MB limit
|
|
ARRAY['image/jpeg', 'image/png', 'image/gif', 'image/webp']
|
|
)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- Create RLS policies for the bucket
|
|
-- Allow authenticated users to upload images
|
|
CREATE POLICY "Authenticated users can upload images"
|
|
ON storage.objects
|
|
FOR INSERT
|
|
TO authenticated
|
|
WITH CHECK (bucket_id = 'content-images');
|
|
|
|
-- Allow authenticated users to update their own images
|
|
CREATE POLICY "Users can update own images"
|
|
ON storage.objects
|
|
FOR UPDATE
|
|
TO authenticated
|
|
USING (bucket_id = 'content-images' AND auth.uid()::text = (storage.foldername(name))[1])
|
|
WITH CHECK (bucket_id = 'content-images');
|
|
|
|
-- Allow authenticated users to delete their own images
|
|
CREATE POLICY "Users can delete own images"
|
|
ON storage.objects
|
|
FOR DELETE
|
|
TO authenticated
|
|
USING (bucket_id = 'content-images' AND auth.uid()::text = (storage.foldername(name))[1]);
|
|
|
|
-- Allow public read access to all images
|
|
CREATE POLICY "Public can view images"
|
|
ON storage.objects
|
|
FOR SELECT
|
|
TO public
|
|
USING (bucket_id = 'content-images'); |