Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #!/bin/bash
  2. # Pre-commit hook to make a mysql dump right before committing and add it to the commit.
  3. #
  4. ## Change the following values to suit your local setup.
  5. # The name of a database user with read access to the database.
  6. DBUSER=root
  7. # The password associated with the above user. Leave commented if none.
  8. #DBPASS=seekrit
  9. # The database associated with this repository.
  10. DBNAME=dplay
  11. # The path relative to the repository root in which to store the sql dump.
  12. DBPATH=schema
  13.  
  14. [[ -d schema ]] || mkdir schema
  15. if [ -t $DBPASS ]; then
  16. mysqldump -u $DBUSER -p$DBPASS $DBNAME > $DBPATH/$DBNAME.sql
  17. else
  18. mysqldump -u $DBUSER $DBNAME > $DBPATH/$DBNAME.sql
  19. fi
  20.  
  21. git add $DBPATH/$DBNAME.sql
  22. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement