Skip to content

Commit 7143d52

Browse files
committed
test
1 parent 631c943 commit 7143d52

File tree

1 file changed

+7
-3
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+7
-3
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ if [ -n "$IS_CI" ]; then
7373
echo "PGVERSION: $PGVERSION"
7474
fi
7575

76+
OLD_BOOTSTRAP_USER=$(run_sql -A -t -c "select rolname from pg_authid where oid = 10;")
77+
7678
cleanup() {
7779
UPGRADE_STATUS=${1:-"failed"}
7880
EXIT_CODE=${?:-0}
@@ -314,8 +316,9 @@ function initiate_upgrade {
314316

315317
echo "8. TODO"
316318
run_sql -c "alter role postgres superuser;"
317-
run_sql -c "create role supabase_tmp login superuser;"
318-
psql -h localhost -U supabase_tmp -d postgres <<-EOSQL
319+
if [ "$OLD_BOOTSTRAP_USER" = "postgres" ]; then
320+
run_sql -c "create role supabase_tmp login superuser;"
321+
psql -h localhost -U supabase_tmp -d postgres <<-EOSQL
319322
begin;
320323
do $$
321324
declare
@@ -469,7 +472,8 @@ end
469472
$$;
470473
rollback;
471474
EOSQL
472-
run_sql -c "drop role supabase_tmp;"
475+
run_sql -c "drop role supabase_tmp;"
476+
fi
473477

474478
if [ -z "$IS_NIX_UPGRADE" ]; then
475479
if [ -d "/usr/share/postgresql/${PGVERSION}" ]; then

0 commit comments

Comments
 (0)