Code First Migration on Production
I am working with EF Code First Migration and before I push to the production, I created the InitialCreate file from scratch and then set the AutomaticMigrationsEnabled flag to 'False'. Then inside my web.config file, I defined my Db Initialization strategy to 'MigrateDatabaseToLatestVersion'..Then I simply deployed my website into production, so far things seems to work fine.
Now, let say I If add new field into of Entity class and push this change into production, it will try to migrate db to latest version and it fail with the error information :
Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.
What I would need to do in this situation? Do I need to set the AutomaticMigrationsEnabled flag to True, or something else which would be suitable for production?
Thanks
Best Regards, Ammar
链接地址: http://www.djcxy.com/p/15984.html上一篇: 在EntityFramework Code First Migrations中覆盖“dbo”模式名称
下一篇: 代码首先生产迁移