Browse Source

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.
pull/6997/head
TriplEight 2 weeks ago
parent
commit
e21669cd0f
No known key found for this signature in database GPG Key ID: 9E9B1BBD89CE29A1
  1. 19
      .github/workflows/integration-test.yml

19
.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)

Loading…
Cancel
Save