Skip to content

Commit

Permalink
fix: disable pgsodium event trigger when swapping roles
Browse files Browse the repository at this point in the history
  • Loading branch information
soedirgo committed Sep 18, 2024
1 parent 6d2051d commit 96b76e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ansible/files/admin_api_scripts/pg_upgrade_scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ declare
begin
set local search_path = '';
if exists (select from pg_event_trigger where evtname = 'pgsodium_trg_mask_update') then
alter event trigger pgsodium_trg_mask_update disable;
end if;
alter role postgres rename to supabase_admin_;
alter role supabase_admin rename to postgres;
alter role supabase_admin_ rename to supabase_admin;
Expand Down Expand Up @@ -507,6 +511,10 @@ begin
execute(format('grant %s on table %s to %s %s', rec.privilege_type, (obj->>'oid')::oid::regclass, rec.grantee::regrole, case when rec.is_grantable then 'with grant option' else '' end));
end loop;
end loop;
if exists (select from pg_event_trigger where evtname = 'pgsodium_trg_mask_update') then
alter event trigger pgsodium_trg_mask_update enable;
end if;
end
$$;
Expand Down

0 comments on commit 96b76e4

Please sign in to comment.