Is there a way I can remove DB migration from an ASP.NET Core project?

Is there a way I can remove migration that already added to the database? I am working on an ASP.NET CORE Project and I am using VS 3.1

Add Comment
1 Answer(s)

Remove Migration

Sometimes you add a migration and realize you need to make additional changes to your EF Core model before applying it. To remove the last migration, you can use the following command.

PM> Remove-Migration 

Revert Migration

If you already applied several migrations to the database but need to revert it, you can use the Update-Database command but also specify the name of the migration you want to roll back to.

PM> Update-Database LastGoodMigration 

For better understanding of EF Core Migrations Tools, check

EF Core Docs

and

EF Core Docs from Microsoft docs website

Answered on August 30, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.