summaryrefslogtreecommitdiff
path: root/git-hooks
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-11-03 10:16:52 -0500
committerOwen Jacobson <owen@grimoire.ca>2024-11-03 10:16:52 -0500
commita73821328fffd5a6bcbc28d9ac91e47806c56119 (patch)
tree6c114fb8bd56c6294db1809926dea9b29fc52384 /git-hooks
parentdb01b7043b94d07e7e9a5131c235f0580ab967f0 (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.
Diffstat (limited to 'git-hooks')
-rwxr-xr-xgit-hooks/pre-commit3
1 files changed, 3 insertions, 0 deletions
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