Search code examples
c#entity-framework-core

Entity framework Core Update-database specific migration


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'.

How can this be resolved?


Solution

  • 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, for EF 1.1:

    update-database -target test32
    

    or, for EF 2.0 and later:

    update-database -migration test32
    

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