What problem does it solve?
Windmill's CI runs with SQLX_OFFLINE=true, so every sqlx::query! macro needs matching cached data in backend/.sqlx/. Running cargo sqlx prepare naively deletes the entire cache before regenerating it, which silently destroys enterprise-edition query entries and breaks CI whenever compilation fails partway.
Core Features & Use Cases
- Safe cache regeneration: Restores the full cache from origin/main, regenerates OSS entries, then grafts back any EE entries that prepare deleted.
- Backup and restore workflow: The bundled sqlx-cache.sh script snapshots backend/.sqlx, lists newly added queries, and restores the backup with only verified new entries grafted on.
- Test-target query handling: Documents how to cache queries inside tests/*.rs using --all-targets despite the known CE-checkout abort, and how to verify both lib and test targets afterward.
- Use Case: After adding a new SQL query to a Rust source file, run the documented procedure to update the offline cache without wiping the 2000+ existing EE entries, then confirm with git diff origin/main --stat backend/.sqlx/.
Quick Start
Update the SQLx offline cache for my new query by backing up backend/.sqlx with the sqlx-cache script, running cargo sqlx prepare against this worktree's database, and restoring any deleted EE entries.