cargo sqlx prepare only works after cargo clean
I have found these related issues/pull requests
https://github.com/launchbadge/sqlx/issues/788
Description
cargo sqlx prepare removes some files (without adding the same amount) in .sqlx/ when changing a query in the codebase. cargo clean does fix the issue, but it seems like running cargo sqlx prepare multiple times ends up producing the correct output as well.
Reproduction steps
cargo sqlx prepare
SQLx version
0.8.6
Enabled SQLx features
"runtime-tokio", "postgres", "chrono", "ipnetwork", "json"
Database server and version
Postgres
Operating system
asahi linux
Rust version
rustc 1.89.0 (29483883e 2025-08-04)
@FrenchGithubUser can you please provide an example project that reproduces the issue? Otherwise there's no place to start here.
https://github.com/Arcadia-Solutions/arcadia
Run sqlx prepapre in backend/storage, then edit one if the queries there, and re-run it
Those are the files that are making the schema-check fail when missing (in .sqlx):
https://github.com/Arcadia-Solutions/arcadia/commit/af9eceb83893ceba780ecf538afb2fab8e140e9e
I removed some old code thinking it might be the issue, but that didn't help.
Also, running cargo sqlx prepare --check locally works fine