简体   繁体   English

FluentMigrator和Azure部署

[英]FluentMigrator and Azure deployments

I have a new ASP.NET MVC project that will be hosted in Azure using their Cloud Services with multiple web roles running. 我有一个新的ASP.NET MVC项目,它将使用其运行多个Web角色的云服务托管在Azure中。 My question is about how to do production deployments using FluentMigrator to do the database changes. 我的问题是如何使用FluentMigrator进行生产部署以进行数据库更改。

If I run FluentMigrator during my TeamCity deployment it seems that it would update the database first and then would do deployments to the multiple web roles one at a time. 如果我在TeamCity部署期间运行FluentMigrator,它似乎首先更新数据库,然后一次一个地部署到多个Web角色。 Therefore, it seems that some users would be accessing the old version of the site and using the new database structure which will lead to mismatches and exceptions being thrown. 因此,似乎某些用户将访问旧版本的站点并使用新的数据库结构,这将导致抛出不匹配和异常。

What are best practices/suggestions for doing deployments to a production Azure SQL Database environment using FluentMigrator? 使用FluentMigrator部署到生产Azure SQL数据库环境的最佳实践/建议是什么?

First off, make sure you deploy to the staging slot and only do a VIP swap once you are happy everything is working fine. 首先,确保您部署到临时插槽,只有在您满意后才能进行VIP交换。

If your migrations include things like adding columns, indexes and tables - these will be non-breaking changes and your old code should work just fine against the new database. 如果您的迁移包括添加列,索引和表等内容 - 这些将是非破坏性更改,并且您的旧代码应该可以正常地对新数据库起作用。

If your migrations include breaking changes though (changing column names, dropping columns, changing columns datatypes) then you should put up a holding page while you deploy. 如果您的迁移包括更改(更改列名,删除列,更改列数据类型),那么您应该在部署时设置保留页面。 We have a flag we set in the config file that serves a holding page while we are doing these type of deployments. 我们在配置文件中设置了一个标志,用于在我们进行这些类型的部署时提供保留页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM