如何在构建过程中包含数据库更改(DDL 补丁、一次性数据插入等)?
我运行构建脚本,然后必须记住每次部署应用程序时要运行哪个数据库 SQL 和 PL/SQL 脚本。如何将这些补丁包含在我的构建脚本中?还是每个人都手动运行它们?目前,我对补丁进行编号,以便知道运行它们的顺序,但有时我必须检查 SVN 历史记录才能知道从哪个编号开始。
我正在使用 PHP,但可以使用 Java 来解决这个问题。
I run my build script and then I have to remember which of the database SQL and PL/SQL scripts to run each time I deploy my application. How can I include these patches in my build script? Or does everybody just run them manually? Currently I number my patches so I know the order to run them, but sometimes I have to check SVN history to know what number to start at.
I'm using PHP but can use Java in my solution to this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
liquibase 可能会为您解决这个问题,它集成到 ant 或 maven 中,但也可以从 cmd 行启动
liquibase might solve this problem for you which integrates into ant or maven but can be started from cmd line too
您应该将更改保存为脚本,并将它们像其他代码一样放入源代码管理中。然后您就知道哪些更改属于哪些构建并且需要升级为产品。
You should be saving your changes as scripts and putting them in source control like the rest of your code. Then you know what changes belong to what build and need to be promoted to prod.
由于您使用的是 PHP phing/DbDeployTask将是一个明智的选择。对于每个数据库表,您将有一个启动文件和许多补丁,例如:
等。
Since you're using PHP phing/DbDeployTask would be a smart choice. For every DB table you will have a start file and a number of patches, e.g.:
etc.