How Can I generate Identity DB Scripts without mig

2019-04-11 20:48发布

问题:

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: No executable found matching command "dotnet-ef"

So I followed a few resources for getting dotnet-ef

and I Installed a few nuget packagets:

  • Microsoft.EntityFrameworkCore.Tools
  • Microsoft.EntityFrameworkCore.Design

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

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

回答1:

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


回答2:

Here are the .sql files on GitHub repository to install the SQL tables.