File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 22-- PostgreSQL database dump
33--
44
5- \restrict wWgHHMzQQcpvhWUMpemmi73YWdLM275u3ztj1caKcgLrT0IBN7ueb4BiLBSxtJt
5+ \restrict SupabaseTestDumpKey123
66
77-- Dumped from database version 15.14
88-- Dumped by pg_dump version 15.14
@@ -999,5 +999,5 @@ CREATE EVENT TRIGGER pgrst_drop_watch ON sql_drop
999999-- PostgreSQL database dump complete
10001000--
10011001
1002- \unrestrict wWgHHMzQQcpvhWUMpemmi73YWdLM275u3ztj1caKcgLrT0IBN7ueb4BiLBSxtJt
1002+ \unrestrict SupabaseTestDumpKey123
10031003
Original file line number Diff line number Diff line change 22-- PostgreSQL database dump
33--
44
5- \restrict wJhXZ3zzSxdOnzT40iWgcbF8W1OVaekHNId1sH6S7U0SApyR73uF8dYaLqibgGY
5+ \restrict SupabaseTestDumpKey123
66
77-- Dumped from database version 17.6
88-- Dumped by pg_dump version 17.6
@@ -1000,5 +1000,5 @@ CREATE EVENT TRIGGER pgrst_drop_watch ON sql_drop
10001000-- PostgreSQL database dump complete
10011001--
10021002
1003- \unrestrict wJhXZ3zzSxdOnzT40iWgcbF8W1OVaekHNId1sH6S7U0SApyR73uF8dYaLqibgGY
1003+ \unrestrict SupabaseTestDumpKey123
10041004
Original file line number Diff line number Diff line change @@ -177,7 +177,21 @@ perform_dump() {
177177 while [ $attempt -le $max_attempts ]; do
178178 echo " Attempting pg_dump (attempt $attempt /$max_attempts )"
179179
180- if " ${PSQLBIN} /pg_dump" -h localhost -p " $PORTNO " -U " $PGSQL_SUPERUSER " -d postgres --schema-only --no-owner --no-privileges > " ./db/schema.sql" ; then
180+ # Build the dump command
181+ local dump_cmd=" ${PSQLBIN} /pg_dump -h localhost -p $PORTNO -U $PGSQL_SUPERUSER -d postgres --schema-only --no-owner --no-privileges"
182+
183+ # Only use --restrict-key for standard PostgreSQL 15 and 17 versions
184+ # OrioleDB doesn't support this flag yet
185+ if [ " $PSQL_VERSION " = " 15" ] || [ " $PSQL_VERSION " = " 17" ]; then
186+ # Use a fixed restrict key for reproducible test dumps
187+ # This is safe in testing contexts but should not be used in production
188+ dump_cmd=" $dump_cmd --restrict-key=SupabaseTestDumpKey123"
189+ echo " Using --restrict-key for reproducible dumps (PostgreSQL $PSQL_VERSION )"
190+ else
191+ echo " Skipping --restrict-key (version: $PSQL_VERSION )"
192+ fi
193+
194+ if $dump_cmd > " ./db/schema.sql" ; then
181195 return 0
182196 fi
183197
@@ -257,7 +271,6 @@ EOSQL
257271
258272 echo " CURRENT_SYSTEM: $CURRENT_SYSTEM "
259273 if [ -f " ./db/schema.sql" ]; then
260- trim_schema
261274 cp " ./db/schema.sql" " ./migrations/schema-$PSQL_VERSION .sql"
262275 echo " Schema file moved to ./migrations/schema-$PSQL_VERSION .sql"
263276 echo " PSQLBIN is $PSQLBIN "
You can’t perform that action at this time.
0 commit comments