-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo sqlx prepare
only works after cargo clean
#788
Comments
I ran into the same issue on version |
I have the same issue, also on
When I run |
Ah @Nehliin do you mean it works the first time for you, then refuses to work? Or you only ever get an empty Also, quick update on my end: the issue persists with sqlx |
@colmanhumphrey It generates an almost empty |
In my case |
The |
The cargo clean workaround is still needed in version cargo-sqlx 0.5.1. |
Closing as duplicate of #663 |
@abonander: Please note that this issue is indeed a duplicate of #663 for the specialized case of Using My own workaround is to prefix both The exact commands I use are: ## Generate sqlx metadata file
touch ./src/lib.rs && SQLX_OFFLINE=true cargo sqlx prepare -- --bin <my_bin_name>
## Check sqlx metadata file, fail if out of sync (CI)
touch ./src/lib.rs && SQLX_OFFLINE=true cargo sqlx prepare --check -- --bin <my_bin_name> For context, I have this in my [dependencies.sqlx]
version = "0.5.7"
default-features = false
features = [
"runtime-actix-rustls",
"macros",
"postgres",
"uuid",
"chrono",
"migrate",
"offline"
] Are there any plans to improve this experience or mention this as a caveat in the docs? Is there anything I could do that would be helpful? Thanks (for looking into this but also for the awesome crate). |
I ran into this today and I think it might have been caused by a mismatch between sqlx-cli (0.6.0) and sqlx (0.6.2). Re-running |
Yes. Updating cli fixed it for me. |
I had the same issue and updating the CLI fixed it for me. |
Same but only for a while. After doing it for a few crates in a workspace, it started failing again. |
I am using "query_as!" and have this issue.
gives :No queries found: until cargo clean is issued. Info
|
Hello, The program builds and runs correctly. |
I found that I experienced this issue with
|
This may already be solved, as I'm running on version
0.4.0-beta.1
.Issue
I run
cargo sqlx prepare -- --bin <bin name>
and get a correctly specifiedsqlx-data.json
file. However, if I run it again, I now get the "empty" file, only specifying what db I'm using:And along with this, I get
warning: no queries found; do you have the `offline` feature enabled
, which seems off, since I do have "offline" enabled.Indeed the same issue arises if I run
cargo sqlx prepare --check -- --bin <bin name>
Workaround
If I run
cargo clean
before the commands, everything works fine. This is both in terms of rerunning the builder, and running--check
.What Else I've Tried
cargo sqlx prepare
#722, I tried just manually deleting./target/sqlx
instead of fullcargo clean
but that didn't work - the folder is empty anyway.target/CACHEDIR.TAG
, didn't work; same fortarget/.rustc_info.json
./target/debug
and that worked... But this is rather similar to runningcargo clean
I guessVersion
My
sqlx
setup:Postgres:
postgres (PostgreSQL) 13.0 (Debian 13.0-1.pgdg100+1)
running on postgres Docker (image 817f2d3d51ec)Thanks
For the great crate!
The text was updated successfully, but these errors were encountered: