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

前端 未结 16 2304
余生分开走
余生分开走 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 09:02

    You can still use the Update-Database command.

    Update-Database -Migration  -Context 
    

    However, judging by the name of your migration i'm assuming it's the first migration so that command may not work. You should be able to delete the entry from the __MigrationHistory table in your database and then run the Remove-Migration command again. You could also delete the migration file and just start again.

提交回复
热议问题