EF Migrations: Rollback last applied migration?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

EF Migrations: Rollback last applied migration?

Message par Clippy »

EF Migrations: Rollback last applied migration?
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: EF Migrations: Rollback last applied migration?

Message par Clippy »

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# »