Skip to content

Commit 2d6b679

Browse files
committed
feat(migrations): predefined role grants
- supabase_etl_admin needs pg_monitor to query system catalog tables (e.g. pg_replication_slots) - supabase_read_only_user needs pg_monitor to view queries in pg_stat_statements - grant pg_create_subscription to postgres with admin option in case users want to create subscriptions with their own roles
1 parent c6002c4 commit 2d6b679

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- migrate:up
2+
grant pg_monitor to supabase_etl_admin, supabase_read_only_user;
3+
4+
do $$
5+
declare
6+
major_version int;
7+
begin
8+
select current_setting('server_version_num')::int / 10000 into major_version;
9+
10+
if major_version >= 16 then
11+
grant pg_create_subscription to postgres with admin option;
12+
end if;
13+
end $$;
14+
15+
-- migrate:down

0 commit comments

Comments
 (0)