mysqldump - git hook - 它允许什么?
在 mkb 用户的帮助下,我构建了这个预提交挂钩:
#!/bin/bash -e
DBHOST=dbhost.yourdomain.com
DBUSER=dbuser
DBPASS=dbpass
DBNAME=dbname
mysqldump -h $DBHOST -u $DBUSER -p $DBPASS -d $DBNAME > sql-version-control/schema.sql
# the -h means host.
# the -u means user.
# the -p means pass.
# the -d means database name (same as "no data").
git add sql-version-control/schema.sql
据我所知:
mysqldump -h $DBHOST -u $DBUSER -p $DBPASS -d $DBNAME > sql-version-control/schema.sql
将转到我的共享(或本地)主机,并将在那里备份实际模式?
然而,我们经常在本地更改架构,然后需要在远程服务器上应用这些更改。
无论如何我可以按照这条路做到这一点吗? 或者有更好的方法来实现预期目的?
提前致谢
With mkb user help, I've build this pre-commit hook:
#!/bin/bash -e
DBHOST=dbhost.yourdomain.com
DBUSER=dbuser
DBPASS=dbpass
DBNAME=dbname
mysqldump -h $DBHOST -u $DBUSER -p $DBPASS -d $DBNAME > sql-version-control/schema.sql
# the -h means host.
# the -u means user.
# the -p means pass.
# the -d means database name (same as "no data").
git add sql-version-control/schema.sql
As far as I can understand:
mysqldump -h $DBHOST -u $DBUSER -p $DBPASS -d $DBNAME > sql-version-control/schema.sql
Will go to my shared (OR local) host, and will do a backup of the atual schema there?
Very often, however, we change the schema locally, and then, we need to apply those changes on the remote server.
Is there anyway I can do this follow this path ?
Or there is a better way for doing the intended ?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论