管理将数据库更改切换到旧版本的同一应用程序共享的数据库的迁移 [英] Managing the migration of breaking database changes to a database shared by old version of the same application

查看:174
本文介绍了管理将数据库更改切换到旧版本的同一应用程序共享的数据库的迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标之一是能够部署一个并行运行旧版本的新版本的Web应用程序。抓住的是所有的东西都共享一个数据库。新版本中的数据库往往包括对数据库表的重大重构。我希望随着时间的推移将新版本的应用程序推出给用户,如果需要,可以将其重新切换回旧版本。



Oren有一个很好的 post 设置问题,但结束于: / p>

关于影响整个系统的变化,我们仍然在部署浑水,关于数据库更改的变化,我将讨论在下一期中,这一个只是一个不了了的,恐怕。



后续的帖子从来没有来过;-)。您将如何管理将数据库更改切换到旧版本的同一应用程序共享的数据库。如何保持数据同步?

解决方案

如果旧版本必须维护,更改根本不能断。这也有助于在部署新版本的网络应用程序时 - 如果您需要回滚,那么如果您可以离开数据库,则真的可以帮助您。



显然,这带来了重大的架构障碍,您几乎肯定会得到一个显示其谱系的数据库,但是根据我的经验,部署好处通常值得头痛。



如果您对每个涉及的旧版本都有一个集成测试的固体集合,这将有助于您。您应该可以针对已迁移的测试数据库针对仍被视为可能存在的每个版本运行它们 - 这在某些情况下可能是每个版本。如果您能够合理地控制部署,您可能只有三到四个版本的兼容性可能会消失 - 在这种情况下,如果有真正的需要,您可以计划逐步淘汰过时的表/列等。只要牢记这种计划的复杂性,不利于应计的利益。


One of my goals is to be able to deploy a new version of a web application that runs side by side the old version. The catch is that everything shares a database. A database that in the new version tends to include significant refactoring to database tables. I would like to be rollout the new version of the application to users over time and to be able to switch them back to the old version if I need to.

Oren had a good post setting up the issue, but it ended with:

"We are still in somewhat muddy water with regards to deploying to production with regards to changes that affects the entire system, to wit, breaking database changes. I am going to discuss that in the next installment, this one got just a tad out of hand, I am afraid."

The follow-on post never came ;-). How would you go about managing the migration of breaking database changes to a database shared by old version of the same application. How would you keep the data synced up?

解决方案

If the old version has to be maintained, the changes simply can't be breaking. That also helps when deploying a new version of a web app - if you need to roll back, it really helps if you can leave the database as it is.

Obviously this comes with significant architectural handicaps, and you will almost certainly end up with a database which shows its lineage, so to speak - but the deployment benefits are usually worth the headaches, in my experience.

It helps if you have a solid collection of integration tests for each old version involved . You should be able to run them against your migrated test database for every version which is still deemed to be "possibly live" - which may well be "every version ever" in some cases. If you're able to control deployment reasonably strictly you may get away with only having compatibility for three or four versions - in which case you can plan phasing out obsolete tables/columns etc if there's a real need. Just bear in mind the complexity of such planning against the benefits accrued.

这篇关于管理将数据库更改切换到旧版本的同一应用程序共享的数据库的迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆