In the standard .NET version of entity framework, you could undo the last database update using.
Update-Database -TargetMigration "NameOfPreviousMigration"
If you try this on Entity Framework for .NET Core (EntityFrameworkCore), you get the following error:
Update-Database : A parameter cannot be found that matches parameter name 'TargetMigration'. At line:1 char:17 + Update-database -TargetMigration "NameOfPreviousMigration" + ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Update-Database], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Update-Database
How can I revert the database in .NET Core?
To do this in EntityFrameworkCore, you don't use the TargetMigration parameter. Just name the migration you wish to revert to.
e.g.
Update-Database NameOfPreviousMigration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With