sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

cargo sqlx prepare only works after cargo clean

Open FrenchGithubUser opened this issue 1 month ago • 3 comments

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 avatar Nov 26 '25 22:11 FrenchGithubUser

@FrenchGithubUser can you please provide an example project that reproduces the issue? Otherwise there's no place to start here.

abonander avatar Nov 27 '25 21:11 abonander

https://github.com/Arcadia-Solutions/arcadia

Run sqlx prepapre in backend/storage, then edit one if the queries there, and re-run it

FrenchGithubUser avatar Nov 27 '25 22:11 FrenchGithubUser

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

FrenchGithubUser avatar Dec 06 '25 23:12 FrenchGithubUser