diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-11-03 10:16:52 -0500 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-11-03 10:16:52 -0500 |
| commit | a73821328fffd5a6bcbc28d9ac91e47806c56119 (patch) | |
| tree | 6c114fb8bd56c6294db1809926dea9b29fc52384 | |
| parent | db01b7043b94d07e7e9a5131c235f0580ab967f0 (diff) | |
Verify .sqlx files against an empty DB.
For reasons beyond my understanding, the `sqlx prepare` command produces different results for sqlite depending on whether there are or are not rows in certain tables. This ensures that the files are generated consistently with an _empty_ database.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rwxr-xr-x | git-hooks/pre-commit | 3 |
2 files changed, 4 insertions, 0 deletions
@@ -1,5 +1,6 @@ /node_modules /target /.hi +/.hi.pre-commit /.hi.backup /vite.config.js.*.mjs diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index 22c5dfe..6715430 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -13,4 +13,7 @@ npm run lint cargo check # Make sure the prepared statement data in .sqlx is up to date. Requires # `cargo-sqlx` (`cargo install cargo-sqlx`). +export DATABASE_URL=sqlite://.hi.pre-commit?mode=rwc +rm -f .hi.pre-commit +cargo sqlx migrate run cargo sqlx prepare --check |
