如何在不迁移的情况下生成Identity DB脚本 [英] How Can I generate Identity DB Scripts without migration

查看:67
本文介绍了如何在不迁移的情况下生成Identity DB脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试修复项目,因此该项目具有IdentityServer4的数据库脚本。我被告知运行

I've been trying to fix a project so it has the db script for IdentityServer4. I've been informed to run

dotnet ef migrations add InitialIdentityServerMigration -c PersistedGrantDbContext

但是,当我运行时会收到错误消息:

However when I run that I receive an error:


dotnet:找不到与命令 dotnet-ef匹配的可执行文件

dotnet: No executable found matching command "dotnet-ef"

所以我遵循了几个获得资源以获取dotnet-ef

So I followed a few resources for getting dotnet-ef

然后我安装了一些nuget软件包:

and I Installed a few nuget packagets:


  • Microsoft.EntityFrameworkCore.Tools

  • Microsoft.EntityFrameworkCore .Design

,但仍然令我收到相同的错误消息。

but still affter all that I receive the same error message.

还有另一种获取Identity4数据库脚本的方法吗?

Is there another way to get the script for a Identity4 DB?

推荐答案

尝试在Package Manager控制台(使用Powershell)中运行较旧样式的语法。

Try running the older style syntax in the Package Manager Console (which is using Powershell).

Add-Migration InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb
Add-Migration InitialIdentityServerConfigurationDbMigration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb
Update-Database -c PersistedGrantDbContext
Update-Database -c ConfigurationDbContext

这篇关于如何在不迁移的情况下生成Identity DB脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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