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
You should delete migration '20160703192724_MyFirstMigration' record from '_EFMigrationsHistory' table.
otherwise this command will remove migration and delete migrations folder:
> remove-migration -force
In order to unapply a migration in EF Core 1.0 use the command:
dotnet ef database update {migration_name}
Use the migration name of the migration until which you would like to preserve your changes. The list of names of the migration can be found using:
dotnet ef migrations list
In general if you are using the Package Manager Console the right way to remove a specific Migration is by referencing the name of the migration
Update-Database -Migration {Name of Migration} -Context {context}
Another way to remove the last migration you have applied according to the docs is by using the command:
dotnet ef migrations remove
This command should be executed from the developer command prompt (how to open command prompt) inside your solution directory.
For example if your application is inside name "Application" and is in the folder c:\Projects. Then your path should be:
C:\Projects\Application
To completely remove all migrations and start all over again, do the following:
dotnet ef database update 0
dotnet ef migrations remove
in Package Manager Console, just Type Remove-Migration And Press Enter. It automatically removes the migration.
Tools -> Nuget Package Manager -> Package Manager Console
at first run the following command :
PM>update-database -migration:0
and then run this one :
PM>remove_migration
Finish