MySQL 版本控制来补充 GIT?
我与一个小型 Web 团队合作,该团队目前正在将 GIT 集成到我们的开发流程中。我们在本地进行开发,拥有一个中央裸存储库,然后将更改拉至单独的测试和生产服务器。这对于我们的文件来说非常有用,但在同步 MySQL 数据库时我们遇到了障碍。
我们有很多网站是用Wordpress建立的,这里的问题比较突出:
- Wordpress将域名插入到数据库中。现在,每当我们将站点从本地移动到测试然后再移动到生产时,我们都会通过查找和替换来解决这个问题。不过,如果我们不必这样做就好了。
- 生产服务器站点数据库不断变化(评论等),测试服务器和我们的本地服务器不同步。这使得将更改(在添加插件、页面等之后)从测试服务器发送到生产数据库变得困难。
如果我们能找到可以与 GIT 集成的东西(也许通过 githooks),让我们能够跨不同的开发和生产服务器同步数据库,那就太好了。此外,如果有一种方法可以跟踪数据库本身内的更改,那么这将是一个额外的好处 - 允许我们在推送到生产时合并更改(开发编辑和生产更改)。
最后,如果这一切都可以跨多个领域(本地、测试和生产)工作,那就更好了;换句话说,它必须在每次推/拉时查找并替换 sql 中的 URL。
非常感谢您的任何见解。
I work with a small web team that is currently in the process of getting GIT integrated into our development process. We develop locally, have a central bare repository and then pull changes down to separate test and production servers. This is working great for our files but we are hitting roadblocks when it comes to syncing MySQL databases.
We have a lot of sites built with Wordpress and the issues are more prominent here:
- Wordpress inserts the domain name into the DB. Right now, we get around this by doing a find and replace whenever we move the sites from local, to testing and then to production. It would be nice if we didn't have to do this, though.
- The production server site DBs are constantly changing (comments, etc.) and the testing server and our local servers are not in sync. This makes it difficult to send changes (after adding a plugin, page, etc.) to the production DB from the test server.
It would be great if we could find something that could integrate with GIT (maybe through githooks) that would allow us to sync the databases across different development and production servers. Moreover, it would be a bonus if there were a way to track changes within the database itself -- allowing us to merge changes (development edits and production changes) when pushing to production.
And finally, it would be even better if this could all work across multiple domains (local, testing and production); in other words, it would have to find and replace the URLs in the sql on each push/pull.
Thanks a bunch for any insight.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要查看 http://www.liquibase.org/。它是一个数据库重构工具,用于创建和修改数据库架构、创建回滚和 SQL 生成代码。我很久以前就被介绍给它了,但记不太清楚了,但它似乎是为了满足你的需要而设计的,而且从我的记忆来看,它非常棒。
You might want to check out http://www.liquibase.org/. It's a database refactoring tool made for creating and modifying database schema, creating rollbacks and code for SQL generation. I was introduced to it a long while back and can't remember it that well, but it seems like it's made for what you need and from what I remember it kicks ass.