EF Core CodeFirst Remove-migration 删除迁移报错

EF Core 在vs2017执行Remove-migration 删除迁移报错

报错信息:The migration '20180828010718_init' has already been applied to the database. Revert it and try again. If the migration has been applied to other databases, consider reverting its changes using a new migration.

EF Core CodeFirst Remove-migration 删除迁移报错_第1张图片

解决方法:

1、Update-Database -Migration:0  (删除表结构)

2、Remove-Migration (删除迁移文件)

EF Core CodeFirst Remove-migration 删除迁移报错_第2张图片

EF Core CodeFirst Remove-migration 删除迁移报错_第3张图片

 成功删除 add-migration 生成的迁移文件,但数据库和数据库迁移记录表还存在的。但并没影响再次执行 add-migration 生成的新迁移文件。

 

转载于:https://www.cnblogs.com/Martincheng/p/9546197.html

你可能感兴趣的:(EF Core CodeFirst Remove-migration 删除迁移报错)