Scope enrollment membership migration and use pull-only deployed gateway

This commit is contained in:
2026-11-17 16:03:54 +01:00
parent 7fd17272d5
commit 60f8f21f54
8 changed files with 258 additions and 67 deletions
@@ -0,0 +1,14 @@
-- Migration 24 could not see FORCE ROW LEVEL SECURITY memberships without a
-- tenant context, even when run by the table owner. Use each tenant's policy.
DO $$
DECLARE
current_tenant uuid;
BEGIN
FOR current_tenant IN SELECT tenant_id FROM tenants LOOP
PERFORM set_config('app.tenant_id', current_tenant::text, true);
UPDATE memberships SET permissions = array_append(permissions, 'devices:enroll')
WHERE tenant_id = current_tenant AND 'devices:revoke' = ANY(permissions)
AND NOT ('devices:enroll' = ANY(permissions));
END LOOP;
END;
$$;