BLOG-145 Add pre-commit hooks #147

Merged
squid merged 5 commits from BLOG-145_add_pre_commit_hooks into main 2025-10-15 13:11:26 +08:00
Showing only changes of commit 1d8a864ad4 - Show all commits

View File

@ -3,4 +3,13 @@
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
cd "$SCRIPT_DIR/../backend" cd "$SCRIPT_DIR/../backend"
# Generate sqlx-data.json
cargo sqlx prepare --workspace cargo sqlx prepare --workspace
# Check if sqlx-data.json was modified and is not staged
if ! git diff --quiet .sqlx; then
echo "Error: json files in .sqlx were modified by 'cargo sqlx prepare' but are not staged."
echo "Please run 'git add backend/.sqlx' and try again."
exit 1
fi