-- ============================================
-- 此文件由 Meoo Cloud 自动生成，请勿修改
-- This file is auto-generated by Meoo Cloud, DO NOT MODIFY
-- ============================================


-- 创建 avatars 存储桶（如果不存在）
INSERT INTO storage.buckets (id, name, public)
VALUES ('avatars', 'avatars', true)
ON CONFLICT (id) DO NOTHING;

-- 添加 RLS 策略
CREATE POLICY avatars_select ON storage.objects
 FOR SELECT
 USING (bucket_id = 'avatars');

CREATE POLICY avatars_insert ON storage.objects
 FOR INSERT
 WITH CHECK (bucket_id = 'avatars' AND auth.uid() = owner);

CREATE POLICY avatars_update ON storage.objects
 FOR UPDATE
 USING (bucket_id = 'avatars' AND auth.uid() = owner);

CREATE POLICY avatars_delete ON storage.objects
 FOR DELETE
 USING (bucket_id = 'avatars' AND auth.uid() = owner);

