-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
I have found these related issues/pull requests
Followup to #4054 since I don't have the permission to reopen it.
I know that cargo sqlx prepare --check
exists already, however that also re-checks the source code. I want to only test that the files are still valid.
Description
Here is my use-case: I want to be able to build a project sqlx with all the guarantees from checking the queries against the database, but without actually having to have a database running for the CI build. For that I can use the .sqlx/*.json
files. So after the build I know already that the files are valid for the code I want to build.
Later in the build pipeline I still need to check if the files are still up-to-date with the database. Since cargo sqlx prepare --check
needs access to the source code to check it and will do a full cargo check
run. I'd like to avoid needing access to cargo or the source code for that validation.
Since the check against the database should succeed in 99.99% of the time, only possibly breaking if I touch the schema (or update the db), it should run in parallel to the tests later to reduce build times.
I have already a working version of sqlx to solve this problem. If my proposal sounds good, I can open a PR. Lmk if there is anything else I need to do for the PR.
Prefered solution
I would like to have a new sqlx
sub-command, e.g. sqlx revalidate
that will take just the files in .sqlx/*.json
, re-execute the query that is already stored in there and check that everything still works.
Is this a breaking change? Why or why not?
This is not a breaking change, I want to add a completely new command.