سامانه صدور فاکتور و حسابداری

test(phase1a): use existing organization_roles role_key constraint in synthetic matrix

davoodmehraban89 committed Oct 16, 2026 at 16:59 UTC 3f45c32f92de0ae46c4e999b4a6d11c7f0a32a2e
1 file changed +3 -3
supabase/tests/phase1a_stage1_sql_behavior.sql
+3 -3
@@ -35,16 +35,16 @@ UPDATE public.licenses SET max_users=GREATEST(max_users,3)
35 INSERT INTO public.organization_members(organization_id,user_id,status,is_owner)
36 VALUES (current_setting('finora_test.org_a')::uuid,'cccc3333-3333-4333-8333-333333333333','active',false);
37 INSERT INTO public.organization_roles(organization_id,role_key,title,is_system,active)
38 -VALUES(current_setting('finora_test.org_a')::uuid,'phase1a-commerce-only','Test commerce create',false,true);
38 +VALUES(current_setting('finora_test.org_a')::uuid,'phase1a_commerce_only','Test commerce create',false,true);
39 INSERT INTO public.organization_role_permissions(organization_id,role_id,module_key,capabilities)
40 SELECT organization_id,id,'commerce',ARRAY['create','read']::text[]
41 -FROM public.organization_roles WHERE role_key='phase1a-commerce-only'
41 +FROM public.organization_roles WHERE role_key='phase1a_commerce_only'
42 AND organization_id=current_setting('finora_test.org_a')::uuid;
43 INSERT INTO public.organization_member_roles(organization_id,member_id,role_id)
44 SELECT m.organization_id,m.id,r.id FROM public.organization_members m
45 JOIN public.organization_roles r ON r.organization_id=m.organization_id
46 WHERE m.user_id='cccc3333-3333-4333-8333-333333333333'
47 -AND m.organization_id=current_setting('finora_test.org_a')::uuid AND r.role_key='phase1a-commerce-only';
47 +AND m.organization_id=current_setting('finora_test.org_a')::uuid AND r.role_key='phase1a_commerce_only';
48 INSERT INTO public.records(organization_id,owner_id,collection,id,data)
49 VALUES(current_setting('finora_test.org_a')::uuid,'cccc3333-3333-4333-8333-333333333333',
50 'invoices','SOURCE_C_1','{"companyId":"COMP_STAGE_1","grandTotal":100}'::jsonb);