Skip to content

Instantly share code, notes, and snippets.

@sirlancelot
Created October 10, 2013 05:49
Show Gist options
  • Select an option

  • Save sirlancelot/6913635 to your computer and use it in GitHub Desktop.

Select an option

Save sirlancelot/6913635 to your computer and use it in GitHub Desktop.
A Bolt.cm Git pre-commit hook to clear the `bolt_log` upon commit. I use Git for deployment purposes and so storing the database in Git makes this a little easier.
#!/bin/bash -e
# Clear up the log of any database added to the index before committing it.
git diff-index --name-only --cached HEAD \
| grep -e "database/.*\.db" \
| while read DB; do
echo "Truncating log table in database: $DB"
sqlite3 "$DB" "DELETE FROM bolt_log; VACUUM;"
git add "$DB"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment