How to deploy with automatic migration enabled?

2019-09-04 22:36发布

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条回答
迷人小祖宗
2楼-- · 2019-09-04 23:20

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.

查看更多
登录 后发表回答