How to deploy with automatic migration enabled?

风流意气都作罢 提交于 2019-12-25 01:24:30

问题


I don't understand the concept of automatic migration.

Having set AutomaticMigrationsEnabled = true; in the Migrations.Configuration class I can't find the place where migration steps are stored.

How will Entity Framework recognize the current state of a production database and update it accordingly when, e.g., my console application is run at the customers' office?

Any information on this is very appreciated.


回答1:


To answer your first question: They aren't stored anywhere. Automatic migrations only means that the migration will take place without you having to do anything about it. Generating a migration file only occurs when you are doing a manual migration. The only trace that automatic migration leaves is a new record in the _MigrationHistory table of your database--which will only be a serialized version of the new model, and not what your changes were.

To answer your second question: You shouldn't have to. Once you're in production, your client shouldn't be able to adjust the database themselves. That's just a terrible idea.



来源:https://stackoverflow.com/questions/27131955/how-to-deploy-with-automatic-migration-enabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!