Files
app/wei_ai_app/supabase/migrations/003_create_storage.sql
2026-01-28 20:28:38 +08:00

32 lines
1.1 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- =============================================
-- Wei AI App - Storage Bucket 创建
-- 注意Storage 的 bucket 需要通过 Supabase Dashboard 或 API 创建
-- 这个 SQL 仅用于记录需要创建的 bucket
-- =============================================
-- Storage Bucket 配置说明:
--
-- Bucket Name: avatars
-- Public: true (头像需要公开访问)
-- File Size Limit: 5MB
-- Allowed MIME Types: image/png, image/jpeg, image/webp, image/gif
--
-- 在 Supabase Studio 中手动创建,或使用以下 API:
--
-- POST /storage/v1/bucket
-- {
-- "id": "avatars",
-- "name": "avatars",
-- "public": true,
-- "file_size_limit": 5242880,
-- "allowed_mime_types": ["image/png", "image/jpeg", "image/webp", "image/gif"]
-- }
-- Storage RLS 策略(需要在 Supabase Dashboard 中配置)
-- 允许所有人读取头像
-- CREATE POLICY "Public Access" ON storage.objects FOR SELECT USING (bucket_id = 'avatars');
--
-- 仅允许管理员上传(后续可修改)
-- CREATE POLICY "Admin Upload" ON storage.objects FOR INSERT
-- WITH CHECK (bucket_id = 'avatars' AND auth.role() = 'service_role');