Quand je cours PM> Remove-Migration -context BloggingContext
dans VS2015 avec un projet ASP.NET Core utilisant EF Core, j'obtiens l'erreur suivante :
System.InvalidOperationException: The migration '20160703192724_MyFirstMigration' has already been applied to the database. Unapply it and try again. If the migration has been applied to other databases, consider reverting its changes using a new migration. at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsScaffolder.RemoveMigration(String projectDir, String rootNamespace, Boolean force)
at Microsoft.EntityFrameworkCore.Design.MigrationsOperations.RemoveMigration(String contextType, Boolean force)
at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsRemoveCommand.<>c__DisplayClass0_0.<Configure>b__0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String[] args)
The migration '20160703192724_MyFirstMigration' has already been applied to the database. Unapply it and try again. If the migration has been applied to other databases, consider reverting its changes using a new migration.
Comment puis-je le désappliquer ? J'utilise la dernière version d'ASP.NET Core 1.0, EF Core et VS2015 Update 3.
11 votes
Essayez d'ajouter
-force
à la fin1 votes
L'article learnentityframeworkcore.com/migrations#reversing-a-migration décrit les étapes. Merci @drewskis pour le lien
0 votes
Merci @MichaelFreidgeim