Skip to content

Commit d74c7e2

Browse files
committed
chore: wip cleanup
1 parent dd60496 commit d74c7e2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

nix/tools/migrate-tool.sh.in

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
[ ! -z "$DEBUG" ] && set -x
3+
[ ! -z "$DEBUG" ] && set -eoux pipefail
44

55
# Function to build flake and return the output path
66
build_flake() {
@@ -125,22 +125,30 @@ if [ "$UPGRADE_METHOD" == "pg_upgrade" ]; then
125125
# Change back to the original directory
126126
popd
127127
echo "Migration complete, running post-migration checks"
128-
echo "Migration complete, running post-migration checks"
129128
echo "NEWDAT IS $NEWDAT"
130129
$NEWVER/bin/pg_ctl start -D "$NEWDAT"
131130
echo "Turning off JIT"
132131
cat << EOF > "$NEWDAT"/jit_off.sql
133-
ALTER SYSTEM SET jit = off;
134-
SELECT pg_reload_conf();
132+
ALTER SYSTEM SET jit = off;
133+
SELECT pg_reload_conf();
135134
EOF
136135
"$NEWVER"/bin/psql -h localhost -U supabase_admin -p 5432 -d postgres -f "$NEWDAT"/jit_off.sql
137136

137+
echo "Setting password encryption method to scram-sha-256"
138+
"$NEWVER"/bin/psql -h localhost -U supabase_admin -p 5432 -d postgres -c "ALTER SYSTEM SET password_encryption = 'scram-sha-256';"
139+
"$NEWVER"/bin/psql -h localhost -U supabase_admin -p 5432 -d postgres -c "SELECT pg_reload_conf();"
140+
141+
echo "Running post-migration data checks"
138142
"$PG_PROVE"/bin/pg_prove --psql="$NEWVER"/bin/psql -h localhost -U supabase_admin -d postgres -p 5432 \
139143
"$PGUPGRADE_TESTS/pg_upgrade/tests/01-schema.sql"
140144
"$PG_PROVE"/bin/pg_prove --psql="$NEWVER"/bin/psql -h localhost -U supabase_admin -d postgres -p 5432 \
141145
"$PGUPGRADE_TESTS/pg_upgrade/tests/02-data.sql"
142146
"$PG_PROVE"/bin/pg_prove --psql="$NEWVER"/bin/psql -h localhost -U supabase_admin -d postgres -p 5432 \
143147
"$PGUPGRADE_TESTS/pg_upgrade/tests/03-settings.sql"
148+
149+
# echo "Dumping database statistics for debugging"
150+
# "$NEWVER"/bin/psql -h localhost -U supabase_admin -p 5432 -d postgres -c "SELECT schemaname, relname, n_live_tup FROM pg_stat_user_tables ORDER BY n_live_tup DESC;"
151+
144152
$NEWVER/bin/pg_ctl stop -D "$NEWDAT"
145153
exit 0
146154
fi

0 commit comments

Comments
 (0)