3

I am trying to target a previous applied migration using dotnet ef -TargetMigration: {MigrationName}

getting below error

Unrecognized option '-TargetMigration:0'

Is this command has been removed in Entity Framework Core? Is there any alternative for this?

Venkata Dorisala
  • 4,783
  • 7
  • 49
  • 90

2 Answers2

2

You can use as shown below on the package manager console :

 PM > Update-Database [[-Migration] <String>]

Parameter :

-Migration <String> 
  • Specifies the target migration.

  • If '0', all migrations will be reverted.

  • If omitted, all pending migrations will be applied.
Sampath
  • 63,341
  • 64
  • 307
  • 441
0

https://docs.efproject.net/en/latest/miscellaneous/cli/dotnet.html

Remember its totally different from what you expect...

dotnet ef migrations list dotnet ef migrations [arg] {option}

dotnet ef migrations add [name]

" " " remove //removes last

as per the instructions manually removing the changes from the database if it has been applied already. e.g dotnet ef database update.

mvermef
  • 3,814
  • 1
  • 23
  • 36