MED-155: add RLS to public schema

This commit is contained in:
Danel Kungla
2025-10-07 16:28:35 +03:00
parent 85070fcadb
commit 258bd62a7f

View File

@@ -0,0 +1,17 @@
DO $$
DECLARE
target_schema text := 'public';
table_name text;
BEGIN
FOR table_name IN
SELECT c.relname
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE n.nspname = target_schema
AND c.relkind = 'r'
LOOP
EXECUTE format('ALTER TABLE %I.%I ENABLE ROW LEVEL SECURITY;', target_schema, table_name);
END LOOP;
END $$;
REVOKE USAGE ON SCHEMA public FROM anon, authenticated;