21 lines
715 B
MySQL
21 lines
715 B
MySQL
|
|
-- ============================================
|
|||
|
|
-- 此文件由 Meoo Cloud 自动生成,请勿修改
|
|||
|
|
-- This file is auto-generated by Meoo Cloud, DO NOT MODIFY
|
|||
|
|
-- ============================================
|
|||
|
|
|
|||
|
|
|
|||
|
|
ALTER TABLE notifications ENABLE ROW LEVEL SECURITY;
|
|||
|
|
|
|||
|
|
-- 用户只能查看自己的通知
|
|||
|
|
CREATE POLICY users_select_own_notifications ON notifications
|
|||
|
|
FOR SELECT USING (recipient_id = auth.uid());
|
|||
|
|
|
|||
|
|
-- 用户只能标记自己的通知为已读
|
|||
|
|
CREATE POLICY users_update_own_notifications ON notifications
|
|||
|
|
FOR UPDATE USING (recipient_id = auth.uid());
|
|||
|
|
|
|||
|
|
-- 系统可以插入通知(通过 service role)
|
|||
|
|
CREATE POLICY service_insert_notifications ON notifications
|
|||
|
|
FOR INSERT WITH CHECK (true);
|
|||
|
|
|