2015-11-27 32 views
2

我尝试迁移后更新我的数据库(V2是迁移的名称):更新数据库调用特定迁移

dnx ef database update V2 -c DataContext -p Infrastructure 

我有一个错误,因为DNX尝试执行所有迁移等不只是V2。

Applying migration '20151127095324_V1' 
... 
There is already an object named 'myEntity' in the database 

你有一个想法,为什么它尝试应用V1迁移?

感谢,

+0

的条目,我发现相同的,如果EF7认为V1还没有运行在数据库上,它似乎想运行它。也许它认为这是事实。在数据库中检查__EFMigrationsHistory表,并在运行之前查看V1是否存在。 – d234

回答

1

下面应该工作

dnx ef database update -c DataContext -p Infrastructure 

如果没有,请检查“移民历史”表中有移民“V1”