实体框架核心更新-数据库特定迁移 [英] Entity framework Core Update-database specific migration

查看:34
本文介绍了实体框架核心更新-数据库特定迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚如何从 nuget 中的包管理器运行特定的迁移.

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

我试过跑:

 update-database -TargetMigration test32

但我确实收到了这条消息:

But I do get this message:

找不到与参数名称TargetMigration"匹配的参数.

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

我从 Microsoft 的文档中了解到该命令到以前的 ef 版本.

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

所以我不确定它在 ef 核心中的情况.

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

推荐答案

根据 EF Core Docs,正确的参数名称是 -Target(对于 EF Core 1.1)或 -Migration(对于 EF Core 2.0)

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

所以在你的情况下:

update-database -target test32

update-database -migration test32

现代"方式是使用常规"命令提示符和 .NET Core CLI,以及类似 dotnet ef database update

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

这篇关于实体框架核心更新-数据库特定迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆