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

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

问题描述

我正在尝试从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核心文档,正确的参数名称为 -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数据库更新< target>

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

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

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