开发者

Git: Export MySQL database on commit?

Is there a way I can utilize git to export/download my MySQL development database that is utilized in my code on a commit or some other way through git so that whenever I clone my projec开发者_开发技巧t, I always have a current copy of the database?

If not, I can always export the database, and add it to the source, I was just wondering if git had the capability of doing this almost like a hook.


I ended up using the git hooks as I anticipated. I created the pre-commit hook and added the following to it:

#!/bin/bash
DBUSER="sysbackup"
DBPASS="password"
DB="database-name"
SCHEMAPATH="DBSchema"

mysqldump -u $DBUSER -p$DBPASS $DB > $SCHEMAPATH/$DB.sql
git add $SCHEMAPATH/$DB.sql
exit 0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜