Root cause: sqlx::query! macros perform compile-time query validation against
the live
DATABASE_URL. The dev PostgreSQL instance does not have a
notifications
schema, so
rustdoc fails when recompiling from scratch — the relations
notifications.notifications,
notifications.preferences, and
notifications.templates do not exist.
Why regular tests still pass: cargo test reuses cached compiled artifacts
from a prior build when the schema existed.
rustdoc does not use those cached artifacts and
recompiles fresh, triggering all sqlx macro checks.
Affected files:
src/repository/notifications.rs
7 errors
INSERT, SELECT ×2, LIST, UPDATE, soft-delete, COUNT
src/repository/preferences.rs
4 errors
UPSERT, LIST, GET by channel, soft-delete
src/repository/templates.rs
6 errors
INSERT, GET, LIST, UPDATE, soft-delete (×2)
tests/integration.rs:639
1 warning
unused variable pref_req — prefix with _pref_req
Fix options (pick one):
- Set
SQLX_OFFLINE=true in CI and local .env — sqlx reads from .sqlx/ cache instead of live DB.
- Add to
.cargo/config.toml: [env] SQLX_OFFLINE = "true" — applies to all builds automatically.
- Restore the
notifications schema in dev PostgreSQL and run sqlx migrate run.