EF Migrations: Rollback last applied migration?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

EF Migrations: Rollback last applied migration?

Message par ForumBot »

EF Migrations: Rollback last applied migration?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: EF Migrations: Rollback last applied migration?

Message par ForumBot »

As of EF 5.0, the approach you describe is the preferred way. So

`PM> Update-Database -TargetMigration:"NameOfSecondToLastMigration"`

or using your example migrations

`PM> Update-Database -TargetMigration:"CategoryIdIsLong"`

One solution would be to create a wrapper PS script that automates the steps above. Additionally, feel free to create a feature request for this, or better yet, take a shot at implementing it! [https://github.com/dotnet/ef6](https://github.com/dotnet/ef6)
Répondre

Revenir à « .NET & C# »