PHP数据库同步

发布于 2024-07-18 09:02:28 字数 250 浏览 4 评论 0原文

我有一个本地服务器,我在其中进行所有测试和工作。 完成后,我只需上传数据库架构以及相关代码即可。 然而,当我对架构进行一些更改时,问题就出现了。 我必须在实时服务器上手动输入“alter table”查询。

有没有办法获取数据库模式中发生的增量更改,以便我可以应用新的更改? 或者我必须手动跟踪?

如果我使用 mysqldump,那么它会生成最终数据库的模式(不使用 alter table 等)。

非常感谢。

I have a local server where I do all my testing and work. Once I am done, I simply upload the db schema along with the relevant code. However the problem arises when I make some changes to the schema. I have to manually type the "alter table" query on my live server.

Is there a way to get the incremental changes that took place in the db schema so that I can just apply the new ones? Or do I have to manually keep track?

If I use mysqldump, then it produces the schema of the final db (not with alter table etc).

Thank you very much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

心意如水 2024-07-25 09:02:28

我保留了与新代码一起发送到生产服务器的增量 SQL 脚本。 我编写了所有内容的脚本,因此应用程序从版本 X 到版本 Y 的更改是“自动”的。 有些人也有撤消脚本以防出现问题。

I keep the delta sql scripts which go to the production server together with the new code. I script everything so the change of the application from version X to version Y is "automatic". Some people also have undo scripts in case something goes wrong.

¢蛋碎的人ぎ生 2024-07-25 09:02:28

如何存储您在开发过程中所做的更改,并作为一个小组来测试这些更改?

How about storing off the changes that you did in development, test those changes as a group to live?

如果没有你 2024-07-25 09:02:28

MySQL Workbench 允许您导出 ALTER 脚本(文件 -> 导出 - > 正向工程师 SQL ALTER 脚本)。 您首先必须导入现有数据库并对其应用修改。 商业版本允许您对实时数据库进行逆向工程,社区版本则导入 CREATE 脚本(这将是现有结构的简单转储)。 或者,您可以使用 DBDesigner 4 对实时数据库进行逆向工程,将所有内容保存到 XML 模型文件并导入这个,但是你会丢失像默认字符集之类的东西......

MySQL Workbench lets you export ALTER scripts (File -> Export -> Forward Engineer SQL ALTER Script). You'll have first to import your existing database and apply your modifications to it. The commercial version lets you reverse engineer a live database, the community one does it importing a CREATE script instead (this would be a simple dump of the existing structure). Alternatively you can reverse engineer a live database with DBDesigner 4, save all to an XML Model file end import this, but you're gonna lose stuff like the default charset and such...

樱花落人离去 2024-07-25 09:02:28

查看 Liquibase。 它是Java,但运行得相当好。

Check out Liquibase. It's Java, but it works fairly well.

花间憩 2024-07-25 09:02:28

您可以使用此工具进行自动化过程^ http://hg.antonoff.info/idler/ mmp/wiki/Home

仅要求 PHP(但版本 >= 5.3)

You can use this tool for automation process^ http://hg.antonoff.info/idler/mmp/wiki/Home

Requirement only PHP (but version >= 5.3)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文