Entity framework Core Update-database specific migration

c# entity-framework-core

Question

I am trying to figure out how to run a specific migration from the package manager in nuget.

I have tried to run:

 update-database -TargetMigration test32

But I do get this message:

A parameter cannot be found that matches parameter name 'TargetMigration'.

I read about that command from Microsoft's documentation to a previous ef version.

So I am not sure how it is in ef core.

1
47
9/8/2019 12:26:35 PM

Accepted Answer

According to EF Core Docs, correct parameter name is -Target (for EF Core 1.1) or -Migration (for EF Core 2.0)

so in your case:

update-database -target test32

or

update-database -migration test32

"Modern" way is to use "regular" command prompt and .NET Core CLI, and command like dotnet ef database update <target>

87
6/5/2018 1:23:14 PM

Popular Answer

The best answer given by Dmitry is a bit incorrect. There's no parameter -Target. The only parameter that can be applied is -Migration. Therefore, the right answer is:

Update-Database -Migration test32


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow