使用 Flyway 提供热修复
让我们考虑一下处理修补程序的最佳策略是什么? Flyway 常见问题解答部分的问题。在这个问题中:
- 应用程序版本 7(和数据库版本 7)已部署在生产中
- 工作从应用程序版本 8 开始
- 数据库版本 8 已开发并部署在验收测试环境中
- 在生产中识别出错误
- 数据库版本 7.1 已开发,必须接受 -已测试
当在验收测试环境中调用 Flyway:migrate 时,它会注意到 v8 已经执行,因此不需要执行 v7.1。
一方面这是有道理的,因为 v7.1 可能与 v8 不兼容,并且这不是由 Flyway 来分析的。快速失败是完全可以理解的。
另一方面,将 v7.1 部署到验收测试环境的唯一方法是清理数据库并使用 target = v7.1 运行 Flyway:migrate,从而丢弃可能已使用的数据。
是否有一个我不知道的功能可以处理这种情况,或者 clean + migrate.target=v7.1 是唯一的选择?
Let's consider the What is the best strategy for dealing with hot fixes? question from the Flyway FAQ section. In this question:
- Application version 7 (and DB version 7) is deployed in production
- Work starts on app version 8
- DB version 8 is developed and deployed in the acceptance test environment
- Bug is identified in production
- DB version 7.1 is developed and must be acceptance-tested
When flyway:migrate will be invoked against the acceptance test environment, it will notice that v8 has already been executed and so that there is no need to execute v7.1.
On one side it makes sense since v7.1 might not be compatible with v8, and it is not up to Flyway to analyze this. Fail-fast is entirely understandable.
On the other side, the only way to deploy v7.1 to the acceptance test environment is to clean the database and run flyway:migrate with target = v7.1, thereby discarding data that might have had its use.
Is there a feature I'm not aware of that handles this case or is clean + migrate.target=v7.1 the only option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不仅仅是不同的功能,更是不同的流程。
如果您确实希望将数据保留在接受环境中,我建议随修补程序一起提供 v8 数据库,然后实际更改可以是 v8.1。在部署相应的代码之前,v8 架构的功能可能会保持未使用状态。然而,在大多数情况下,这不会造成任何损害。
More than a different feature, it's about a different process.
If you do wish to keep your data in your acceptance environment, I would recommend shipping v8 of the database with the hotfix and the actual change can then be v8.1. The features of the v8 schema might remain unused until the corresponding code gets deployed. In most cases however, this causes no harm.