3

当我尝试使用update-database -verbose -force时,我收到一个错误:

ALTER TABLE DROP COLUMN failed because column 'countReferralsRegistrations' does not exist in table 'UserProfile'.

问题是 - 我在模型和表 UserProfile 中没有(而且我不想有)这个列。

我该如何解决?

4

2 回答 2

3

解决方案

先用:Add-Migration InitialMigrations -IgnoreChanges然后 update-database verbose. 这将起作用

于 2013-03-27T12:07:18.433 回答
0

这会发生,因为您可以手动删除表列并更新数据库,

这是解决方案。- 打开您最后创建的迁移文件。- 注释下面的行并再次更新数据库 - DropForeignKey、DropIndex、DropColumn

谢谢你..

于 2016-11-04T05:57:54.677 回答