Posted By

craig0990 on 09/04/09


Tagged

mysqldump git precommit


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

mattrichardson
rebellion


Git Pre-Commit MySQL Dump / Backup


 / Published in: Bash
 

  1. #!/bin/sh
  2. # Refresh the SQL schema file for inclusion within the git commit
  3.  
  4. # If something fails, exit with status other than 0
  5. set -e
  6.  
  7. # first, remove our original schema
  8. cd /var/www
  9. rm -f filename.sql
  10.  
  11. # generate a new schema
  12. mysqldump -u username --password=password database > filename.sql
  13.  
  14. # Add the schema to the next commit
  15. git add filename.sql
  16.  
  17. # Exit success
  18. exit 0

Report this snippet  

You need to login to post a comment.