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


-- companies 表 RLS 策略
-- 用户只能查看、修改自己公司的数据
CREATE POLICY users_select_own_company ON public.companies
FOR SELECT USING (
 id = public.get_user_master_company_id()
);

CREATE POLICY users_update_own_company ON public.companies
FOR UPDATE USING (
 id = public.get_user_master_company_id()
);

-- 允许创建公司（注册时需要）
CREATE POLICY users_insert_company ON public.companies
FOR INSERT WITH CHECK (true);

