diff --git a/migrations/schema-15.sql b/migrations/schema-15.sql index 802fbae79..750436ae1 100644 --- a/migrations/schema-15.sql +++ b/migrations/schema-15.sql @@ -1,3 +1,10 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.8 +-- Dumped by pg_dump version 15.8 + SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; @@ -998,8 +1005,3 @@ CREATE EVENT TRIGGER pgrst_drop_watch ON sql_drop -- PostgreSQL database dump complete -- - --- --- Dbmate schema migrations --- - diff --git a/migrations/schema-17.sql b/migrations/schema-17.sql index eac1280b1..d727581ce 100644 --- a/migrations/schema-17.sql +++ b/migrations/schema-17.sql @@ -1,3 +1,10 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 17.4 +-- Dumped by pg_dump version 17.4 + SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; @@ -985,8 +992,3 @@ CREATE EVENT TRIGGER pgrst_drop_watch ON sql_drop -- PostgreSQL database dump complete -- - --- --- Dbmate schema migrations --- - diff --git a/migrations/schema-orioledb-17.sql b/migrations/schema-orioledb-17.sql index 013b23d1f..62902f08a 100644 --- a/migrations/schema-orioledb-17.sql +++ b/migrations/schema-orioledb-17.sql @@ -1,3 +1,10 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 17.0 +-- Dumped by pg_dump version 17.0 + SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; @@ -999,8 +1006,3 @@ CREATE EVENT TRIGGER pgrst_drop_watch ON sql_drop -- PostgreSQL database dump complete -- - --- --- Dbmate schema migrations --- - diff --git a/nix/tools/dbmate-tool.sh.in b/nix/tools/dbmate-tool.sh.in index ca38f3ac1..d914c5aec 100644 --- a/nix/tools/dbmate-tool.sh.in +++ b/nix/tools/dbmate-tool.sh.in @@ -187,17 +187,10 @@ perform_dump() { local attempt=1 while [ $attempt -le $max_attempts ]; do - echo "Attempting dbmate dump (attempt $attempt/$max_attempts)" + echo "Attempting pg_dump (attempt $attempt/$max_attempts)" - # Run dbmate dump - if dbmate dump; then - # Post-process schema.sql to remove schema_migrations INSERT statements - if [ -f "db/schema.sql" ]; then - # Remove INSERT INTO schema_migrations lines - sed -i '/^INSERT INTO schema_migrations/d' db/schema.sql - echo "Schema dump completed successfully (schema_migrations data removed)" - return 0 - fi + if "${PSQLBIN}/pg_dump" -h localhost -p "$PORTNO" -U "$PGSQL_SUPERUSER" -d postgres --schema-only --no-owner --no-privileges > "./db/schema.sql"; then + return 0 fi echo "Dump attempt $attempt failed, waiting before retry..."