Skip to content

Commit ce40e8e

Browse files
committed
test
1 parent 5d51ecc commit ce40e8e

File tree

1 file changed

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

1 file changed

+5
-2
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,16 @@ function initiate_upgrade {
310310
handle_extensions
311311

312312
echo "8. TODO"
313-
# run_sql -c "ALTER USER postgres WITH SUPERUSER;"
314-
run_sql <<-EOSQL
313+
run_sql -c "alter role postgres superuser;"
314+
run_sql -c "create role supabase_tmp login superuser;"
315+
psql -h localhost -U supabase_tmp -d postgres "$@" <<-EOSQL
315316
begin;
316317
alter role postgres rename to supabase_admin_;
317318
alter role supabase_admin rename to postgres;
318319
alter role supabase_admin_ rename to supabase_admin;
319320
commit;
320321
EOSQL
322+
run_sql -c "drop role supabase_tmp;"
321323

322324
if [ -z "$IS_NIX_UPGRADE" ]; then
323325
if [ -d "/usr/share/postgresql/${PGVERSION}" ]; then
@@ -372,6 +374,7 @@ EOSQL
372374
--new-bindir=${PGBINNEW} \
373375
--old-datadir=${PGDATAOLD} \
374376
--new-datadir=${PGDATANEW} \
377+
--username=supabase_admin \
375378
--jobs="${WORKERS}" -r \
376379
--old-options='-c config_file=${POSTGRES_CONFIG_PATH}' \
377380
--old-options="-c shared_preload_libraries='${SHARED_PRELOAD_LIBRARIES}'" \

0 commit comments

Comments
 (0)