|
1 | 1 | #!/usr/bin/env bash
|
2 | 2 |
|
3 |
| -[ ! -z "$DEBUG" ] && set -x |
| 3 | +[ ! -z "$DEBUG" ] && set -eoux pipefail |
4 | 4 |
|
5 | 5 | # Function to build flake and return the output path
|
6 | 6 | build_flake() {
|
@@ -125,22 +125,30 @@ if [ "$UPGRADE_METHOD" == "pg_upgrade" ]; then
|
125 | 125 | # Change back to the original directory
|
126 | 126 | popd
|
127 | 127 | echo "Migration complete, running post-migration checks"
|
128 |
| - echo "Migration complete, running post-migration checks" |
129 | 128 | echo "NEWDAT IS $NEWDAT"
|
130 | 129 | $NEWVER/bin/pg_ctl start -D "$NEWDAT"
|
131 | 130 | echo "Turning off JIT"
|
132 | 131 | 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(); |
135 | 134 | EOF
|
136 | 135 | "$NEWVER"/bin/psql -h localhost -U supabase_admin -p 5432 -d postgres -f "$NEWDAT"/jit_off.sql
|
137 | 136 |
|
| 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" |
138 | 142 | "$PG_PROVE"/bin/pg_prove --psql="$NEWVER"/bin/psql -h localhost -U supabase_admin -d postgres -p 5432 \
|
139 | 143 | "$PGUPGRADE_TESTS/pg_upgrade/tests/01-schema.sql"
|
140 | 144 | "$PG_PROVE"/bin/pg_prove --psql="$NEWVER"/bin/psql -h localhost -U supabase_admin -d postgres -p 5432 \
|
141 | 145 | "$PGUPGRADE_TESTS/pg_upgrade/tests/02-data.sql"
|
142 | 146 | "$PG_PROVE"/bin/pg_prove --psql="$NEWVER"/bin/psql -h localhost -U supabase_admin -d postgres -p 5432 \
|
143 | 147 | "$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 | + |
144 | 152 | $NEWVER/bin/pg_ctl stop -D "$NEWDAT"
|
145 | 153 | exit 0
|
146 | 154 | fi
|
|
0 commit comments