我有以下scenario-合并多个迁移实体框架代码优先
我在我加入了3个新的迁移分支机构的工作 - 为约定我将它们命名为
Migration A
Migration B
Migration C
当试图合并master
原来有4个新的迁移,不按时间顺序排列(从另一个分支合并)。我的意思是下面
new Migration from master 1
existing Migration in both branches
existing Migration in both branches
new Migration from master 2
new Migration from master 3
new Migration from master 4
existing Migration in both branches
existing Migration in both branches
当合并出现以下情形现在
new Migration from master 1
existing Migration in both branches
existing Migration in both branches
new Migration from master 2
new Migration from master 3
new Migration from master 4
existing Migration in both branches
existing Migration in both branches
Migration A
Migration B
Migration C
显然实体框架不会放过,因为它认为该模式是错误的我更新数据库 - 添加时新的迁移将生成从master
提到的4个新迁移中的更改。
真正的问题是,我不能恢复到现有的迁移,然后重新支架来更新元数据,因为它们不是按时间顺序排列 (如在另一个question每接受answer建议)。
我试图update-database -target
回迁移之前new Migration from master 1
,然后Add-Migration <timestamp> new Migration from master 1
重新脚手架,但我得到了Unable to generate an explicit migration because the following explicit migrations are pending....
例外。
我真的不想增加空白迁移来解决这个问题,而是找到一个干净和良好的解决方案。