Migrations EF : annuler la dernière migration appliquée ?

Migrations EF : annuler la dernière migration appliquée ?


Source : [Stack Overflow](GitHub - dotnet/ef6: This is the codebase for Entity Framework 6 (previously maintained at https://entityframework.codeplex.com). Entity Framework Core is maintained at https://github.com/dotnet/efcore. · GitHub](GitHub - dotnet/ef6: This is the codebase for Entity Framework 6 (previously maintained at https://entityframework.codeplex.com). Entity Framework Core is maintained at https://github.com/dotnet/efcore. · GitHub)

À partir d’EF 5.0, l’approche que vous décrivez est la méthode recommandée. Donc

PM> Update-Database -TargetMigration:"NameOfSecondToLastMigration"

ou en utilisant vos migrations d’exemple

PM> Update-Database -TargetMigration:"CategoryIdIsLong"

Une solution serait de créer un script PS wrapper qui automatise les étapes ci-dessus. De plus, n’hésitez pas à créer une demande de fonctionnalité pour cela, ou mieux encore, essayez de l’implémenter vous-même ! https://github.com/dotnet/ef6