Skip to content

Commit be6e6c3

Browse files
committed
feat: for schema tests, try to use pg_dump
1 parent dd2363e commit be6e6c3

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

nix/tools/dbmate-tool.sh.in

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,10 @@ perform_dump() {
187187
local attempt=1
188188

189189
while [ $attempt -le $max_attempts ]; do
190-
echo "Attempting dbmate dump (attempt $attempt/$max_attempts)"
190+
echo "Attempting pg_dump (attempt $attempt/$max_attempts)"
191191

192-
# Run dbmate dump
193-
if dbmate dump; then
194-
# Post-process schema.sql to remove schema_migrations INSERT statements
195-
if [ -f "db/schema.sql" ]; then
196-
# Remove INSERT INTO schema_migrations lines
197-
sed -i '/^INSERT INTO schema_migrations/d' db/schema.sql
198-
echo "Schema dump completed successfully (schema_migrations data removed)"
199-
return 0
200-
fi
192+
if "${PSQLBIN}/pg_dump" -h localhost -p "$PORTNO" -U "$PGSQL_SUPERUSER" -d postgres --schema-only --no-owner --no-privileges > "./db/schema.sql"; then
193+
return 0
201194
fi
202195

203196
echo "Dump attempt $attempt failed, waiting before retry..."

0 commit comments

Comments
 (0)