File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
ansible/files/admin_api_scripts/pg_upgrade_scripts Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ CI_start_postgres() {
88
88
89
89
swap_postgres_and_supabase_admin () {
90
90
run_sql << 'EOSQL '
91
+ alter database postgres connection limit 0;
92
+ select pg_terminate_backend(pid) from pg_stat_activity where backend_type = 'client backend' and pid != pg_backend_pid();
93
+ EOSQL
94
+ run_sql << 'EOSQL '
91
95
set statement_timeout = '300s';
92
96
begin;
93
97
create role supabase_tmp superuser;
@@ -509,6 +513,8 @@ begin
509
513
end
510
514
$$;
511
515
516
+ alter database postgres connection limit -1;
517
+
512
518
set session authorization supabase_admin;
513
519
drop role supabase_tmp;
514
520
commit;
Original file line number Diff line number Diff line change @@ -125,6 +125,9 @@ cleanup() {
125
125
echo " Removing SUPERUSER grant from postgres"
126
126
run_sql -c " ALTER USER postgres WITH NOSUPERUSER;"
127
127
128
+ echo " Resetting postgres database connection limit"
129
+ run_sql -c " ALTER DATABASE postgres CONNECTION LIMIT -1;"
130
+
128
131
if [ -z " $IS_CI " ] && [ -z " $IS_LOCAL_UPGRADE " ]; then
129
132
echo " Unmounting data disk from ${MOUNT_POINT} "
130
133
umount $MOUNT_POINT
You can’t perform that action at this time.
0 commit comments