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


-- 删除旧的 RLS 策略
DROP POLICY IF EXISTS users_select_process_steps ON public.plan_process_steps;
DROP POLICY IF EXISTS users_insert_process_steps ON public.plan_process_steps;
DROP POLICY IF EXISTS users_update_process_steps ON public.plan_process_steps;

-- 创建优化的 RLS 策略（直接使用 company_id）
CREATE POLICY users_select_process_steps ON public.plan_process_steps
FOR SELECT USING (
 company_id = public.get_user_master_company_id()
);

CREATE POLICY users_insert_process_steps ON public.plan_process_steps
FOR INSERT WITH CHECK (
 company_id = public.get_user_master_company_id()
);

CREATE POLICY users_update_process_steps ON public.plan_process_steps
FOR UPDATE USING (
 company_id = public.get_user_master_company_id()
);

CREATE POLICY users_delete_process_steps ON public.plan_process_steps
FOR DELETE USING (
 company_id = public.get_user_master_company_id()
);

