How to unapply a migration in ASP.NET Core with EF Core

前端 未结 16 2270
余生分开走
余生分开走 2020-12-07 08:10

When I run PM> Remove-Migration -context BloggingContext in VS2015 with an ASP.NET Core project using EF Core I get the following error:

Syst         


        
16条回答
  •  粉色の甜心
    2020-12-07 08:46

    To revert the last applied migration you should (package manager console commands):

    1. Revert migration from database: PM> Update-Database
    2. Remove migration file from project (or it will be reapplied again on next step)
    3. Update model snapshot: PM> Remove-Migration

    UPD: The second step seems to be not required in latest versions of Visual Studio (2017).

提交回复
热议问题