Skip to content

Commit 66b57db

Browse files
committed
fix: disable client connections during upgrade
1 parent 7630b53 commit 66b57db

File tree

1 file changed

+5
-0
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+5
-0
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/common.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ begin;
9393
create role supabase_tmp superuser;
9494
set session authorization supabase_tmp;
9595
96+
alter database postgres connection limit 0;
97+
select pg_terminate_backend(pid) from pg_stat_activity where backend_type = 'client backend' and pid != pg_backend_pid();
98+
9699
do $$
97100
begin
98101
if exists (select from pg_extension where extname = 'timescaledb') then
@@ -509,6 +512,8 @@ begin
509512
end
510513
$$;
511514
515+
alter database postgres connection limit -1;
516+
512517
set session authorization supabase_admin;
513518
drop role supabase_tmp;
514519
commit;

0 commit comments

Comments
 (0)