mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-23 16:10:37 +00:00
It makes them much easier to reason about, and allows other SQL tooling to operate on them like language servers, formatters, etc. I also brought back the removed migrations such that we can more easily understand what they were. I included a "-- SKIP" comment describing why those migrations are now skipped. We no longer skip migrations by checking if it is empty, but instead check to see if the migration starts with "-- SKIP".
19 lines
673 B
SQL
19 lines
673 B
SQL
DO $$
|
|
DECLARE
|
|
role_name text;
|
|
BEGIN
|
|
FOR role_name IN SELECT rolname FROM pg_roles WHERE pg_has_role(rolname, 'neon_superuser', 'member')
|
|
LOOP
|
|
RAISE NOTICE 'EXECUTING ALTER ROLE % INHERIT', quote_ident(role_name);
|
|
EXECUTE 'ALTER ROLE ' || quote_ident(role_name) || ' INHERIT';
|
|
END LOOP;
|
|
|
|
FOR role_name IN SELECT rolname FROM pg_roles
|
|
WHERE
|
|
NOT pg_has_role(rolname, 'neon_superuser', 'member') AND NOT starts_with(rolname, 'pg_')
|
|
LOOP
|
|
RAISE NOTICE 'EXECUTING ALTER ROLE % NOBYPASSRLS', quote_ident(role_name);
|
|
EXECUTE 'ALTER ROLE ' || quote_ident(role_name) || ' NOBYPASSRLS';
|
|
END LOOP;
|
|
END $$;
|