Skip to content

Commit d43da9c

Browse files
committed
test
1 parent 22ffee2 commit d43da9c

File tree

1 file changed

+4
-8
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+4
-8
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,11 @@ function initiate_upgrade {
311311
echo "7. Disabling extensions and generating post-upgrade script"
312312
handle_extensions
313313

314-
# TODO: Only do postgres <-> supabase_admin swap if upgrading from postgres
315-
# as bootstrap user to supabase_admin as bootstrap user.
316-
317-
echo "8. TODO"
314+
echo "8. Swap postgres & supabase_admin roles if upgrading from a project with postgres as bootstrap user"
318315
if [ "$OLD_BOOTSTRAP_USER" = "postgres" ]; then
319316
run_sql -c "alter role postgres superuser; create role supabase_tmp login superuser;"
320-
psql -h localhost -U supabase_tmp -d postgres <<-EOSQL
321-
begin;
322-
do \$\$
317+
psql -h localhost -U supabase_tmp -d postgres <<'EOSQL'
318+
do $$
323319
declare
324320
postgres_rolpassword text := (select rolpassword from pg_authid where rolname = 'postgres');
325321
supabase_admin_rolpassword text := (select rolpassword from pg_authid where rolname = 'supabase_admin');
@@ -468,7 +464,7 @@ begin
468464
execute(format('alter table %I.%I owner to postgres;', rec.relnamespace::regnamespace, rec.relname));
469465
end loop;
470466
end
471-
\$\$;
467+
$$;
472468
EOSQL
473469
run_sql -c "alter role postgres nosuperuser; drop role supabase_tmp;"
474470
fi

0 commit comments

Comments
 (0)