简体   繁体   English

结合使用EF Core迁移和现有EF6迁移

[英]Using EF Core migrations with existing EF6 migrations

I'm currently trying to refactor an existing .NET Framework enterprise project into .NET Core. 我目前正在尝试将现有的.NET Framework企业项目重构为.NET Core。 I've gotten the classes moved to Core, as well as set up the Fluent Configurations for all the objects. 我已经将类移至Core,并为所有对象设置了Fluent Configurations。

We are using EF's Migrations to manage the database, so we have our stack of migrations that exist in the __MigrationHistory table EF6 created. 我们正在使用EF的迁移来管理数据库,因此我们在__MigrationHistory__MigrationHistory中创建了我们的迁移堆栈。 Now with EF Core, that wants to create an __EFMigrationsHistory table instead. 现在使用EF Core,它想创建一个__EFMigrationsHistory表。

Is there any way to get EF Core to recognize all of the migrations that existed in that other table? 有什么方法可以让EF Core识别该其他表中存在的所有迁移?

不建议尝试直接重用迁移,建议您改为添加新的迁移,然后删除Up / Down更改,以从本质上将迁移重置为当前模型/数据库配置,如Microsoft文档上的建议。最佳

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM