【发布时间】:2019-10-10 22:08:36
【问题描述】:
我在 VS for Mac 上创建了我的数据库模型,并使用终端创建迁移:
dotnet ef migrations add IntitialMigration
然后,我更新了我的数据库:
dotnet ef database update
但是在我更改了模型并创建了另一个迁移之后:
dotnet ef migrations add SecondMigration
并尝试更新数据库:
dotnet ef database update SecondMigration
我收到以下错误:
数据库中已经有一个名为“电子邮件”的对象。
我已经搜索过,我找到了一个可能的解决方案:
Add-Migration SecondMigration -IgnoreChanges
但这仅适用于 Windows 上的 PMC。我正在使用 VS for Mac,所有命令都在终端上输入。有人知道如何在更改模型后使用迁移更新数据库吗?
【问题讨论】:
-
请问您在带有 asp.net core 的 vs for mac 上找到上述问题的解决方案了吗?
标签: database migration .net-core command-line-interface visual-studio-mac