From e21669cd0f44d30cfeb6856936b08cd61d9afb38 Mon Sep 17 00:00:00 2001 From: TriplEight Date: Sun, 22 Mar 2026 15:55:13 +0100 Subject: [PATCH] ci: use DIESEL_CONFIG_FILE=/dev/null to suppress schema regeneration Replacing the previous git checkout approach: using DIESEL_CONFIG_FILE pointing to /dev/null gives diesel an empty config with no [print_schema] section, so schema.rs is never written. This is cleaner than restoring the file after the fact, which would silently hide genuine schema drift. --- .github/workflows/integration-test.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index e9314851..a0ce17fd 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -87,13 +87,12 @@ jobs: # Verify that all PostgreSQL migrations apply cleanly to a fresh database. # This catches broken SQL before it reaches a production deployment. - # Restore src/db/schema.rs after running: diesel.toml has [print_schema] - # configured, so diesel rewrites the file with backend-specific types after - # migration. The checked-in schema.rs must be restored before compiling. + # DIESEL_CONFIG_FILE=/dev/null disables the [print_schema] setting from + # diesel.toml so that schema.rs is not overwritten during the check. - name: Run PostgreSQL migrations - run: | - diesel migration run --migration-dir migrations/postgresql - git checkout -- src/db/schema.rs + env: + DIESEL_CONFIG_FILE: /dev/null + run: diesel migration run --migration-dir migrations/postgresql # Run the test suite with a live PostgreSQL instance available. # Existing tests are unit tests (no DB access), but DATABASE_URL is set @@ -157,11 +156,11 @@ jobs: run: cargo install diesel_cli --no-default-features --features mysql # Verify that all MySQL migrations apply cleanly to a fresh database. - # Restore src/db/schema.rs for the same reason as the PostgreSQL job above. + # DIESEL_CONFIG_FILE=/dev/null for the same reason as the PostgreSQL job. - name: Run MySQL migrations - run: | - diesel migration run --migration-dir migrations/mysql - git checkout -- src/db/schema.rs + env: + DIESEL_CONFIG_FILE: /dev/null + run: diesel migration run --migration-dir migrations/mysql # Run the test suite with a live MySQL instance available. - name: Run tests (mysql)