使用 PostgreSQL

参考官方教程进行了一波操作:

  1. Create a new Windows user named postgres and add it to the Administrators group.

  2. Open cmd (command prompt) as the postgres command using the following command: runas /user:postgres cmd.exe

  3. A new window appears, you need to run the installer file from this window.

Full Stack 03 - 图1

Full Stack 03 - 图2

下载 pgadmin4,可能你的 PostgreSQL 已经带了它。也可以使用 DataGrip,前提是你有 JetBrains 授权。

通过 EF 创建数据库

~\Data\Migrations 文件夹下的迁移文件是模板自带的,它仅适用于 Sqlite,所以直接删除整个文件夹。

Full Stack 03 - 图3

dotnet ef migrations add initial_identity_migration -c ApplicationDbContext -o Data/Migrations/AspNetIdentity/ApplicationDb

Full Stack 03 - 图4

dotnet ef migrations add initial_is4_server_config_migration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb

dotnet ef migrations add initial_is4_persisted_grant_migration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb

更新数据库:

  1. dotnet ef database update --context ApplicationDbContext
  2. dotnet ef database update --context ConfigurationDbContext
  3. dotnet ef database update --context PersistedGrantDbContext

Full Stack 03 - 图5