feat: 补充数据库脚本和配置

This commit is contained in:
贺爱泽
2025-12-01 18:16:49 +08:00
parent 84ac31158c
commit 15fc000cfc
37 changed files with 42829 additions and 448 deletions

View File

@@ -0,0 +1,185 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TakeoutSaaS.Infrastructure.Identity.Persistence;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Identity.Migrations
{
[DbContext(typeof(IdentityDbContext))]
[Migration("20251201094410_AddEntityComments")]
partial class AddEntityComments
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.IdentityUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasComment("实体唯一标识。");
b.Property<string>("Account")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("登录账号。");
b.Property<string>("Avatar")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("头像地址。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<Guid?>("CreatedBy")
.HasColumnType("uuid")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<Guid?>("DeletedBy")
.HasColumnType("uuid")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("展示名称。");
b.Property<Guid?>("MerchantId")
.HasColumnType("uuid")
.HasComment("所属商户(平台管理员为空)。");
b.Property<string>("PasswordHash")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("密码哈希。");
b.Property<string>("Permissions")
.IsRequired()
.HasColumnType("text")
.HasComment("权限集合。");
b.Property<string>("Roles")
.IsRequired()
.HasColumnType("text")
.HasComment("角色集合。");
b.Property<Guid>("TenantId")
.HasColumnType("uuid")
.HasComment("所属租户 ID。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<Guid?>("UpdatedBy")
.HasColumnType("uuid")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "Account")
.IsUnique();
b.ToTable("identity_users", null, t =>
{
t.HasComment("管理后台账户实体(平台管理员、租户管理员或商户员工)。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.MiniUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasComment("实体唯一标识。");
b.Property<string>("Avatar")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("头像地址。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<Guid?>("CreatedBy")
.HasColumnType("uuid")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<Guid?>("DeletedBy")
.HasColumnType("uuid")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("Nickname")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("昵称。");
b.Property<string>("OpenId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("微信 OpenId。");
b.Property<Guid>("TenantId")
.HasColumnType("uuid")
.HasComment("所属租户 ID。");
b.Property<string>("UnionId")
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("微信 UnionId可能为空。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<Guid?>("UpdatedBy")
.HasColumnType("uuid")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "OpenId")
.IsUnique();
b.ToTable("mini_users", null, t =>
{
t.HasComment("小程序用户实体。");
});
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,581 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Identity.Migrations
{
/// <inheritdoc />
public partial class AddEntityComments : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterTable(
name: "mini_users",
comment: "小程序用户实体。");
migrationBuilder.AlterTable(
name: "identity_users",
comment: "管理后台账户实体(平台管理员、租户管理员或商户员工)。");
migrationBuilder.AlterColumn<Guid>(
name: "UpdatedBy",
table: "mini_users",
type: "uuid",
nullable: true,
comment: "最后更新人用户标识,匿名或系统操作时为 null。",
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedAt",
table: "mini_users",
type: "timestamp with time zone",
nullable: true,
comment: "最近一次更新时间UTC从未更新时为 null。",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "UnionId",
table: "mini_users",
type: "character varying(128)",
maxLength: 128,
nullable: true,
comment: "微信 UnionId可能为空。",
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128,
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "TenantId",
table: "mini_users",
type: "uuid",
nullable: false,
comment: "所属租户 ID。",
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<string>(
name: "OpenId",
table: "mini_users",
type: "character varying(128)",
maxLength: 128,
nullable: false,
comment: "微信 OpenId。",
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128);
migrationBuilder.AlterColumn<string>(
name: "Nickname",
table: "mini_users",
type: "character varying(64)",
maxLength: 64,
nullable: false,
comment: "昵称。",
oldClrType: typeof(string),
oldType: "character varying(64)",
oldMaxLength: 64);
migrationBuilder.AlterColumn<Guid>(
name: "DeletedBy",
table: "mini_users",
type: "uuid",
nullable: true,
comment: "删除人用户标识(软删除),未删除时为 null。",
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DeletedAt",
table: "mini_users",
type: "timestamp with time zone",
nullable: true,
comment: "软删除时间UTC未删除时为 null。",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "CreatedBy",
table: "mini_users",
type: "uuid",
nullable: true,
comment: "创建人用户标识,匿名或系统操作时为 null。",
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedAt",
table: "mini_users",
type: "timestamp with time zone",
nullable: false,
comment: "创建时间UTC。",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<string>(
name: "Avatar",
table: "mini_users",
type: "character varying(256)",
maxLength: 256,
nullable: true,
comment: "头像地址。",
oldClrType: typeof(string),
oldType: "character varying(256)",
oldMaxLength: 256,
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "Id",
table: "mini_users",
type: "uuid",
nullable: false,
comment: "实体唯一标识。",
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<Guid>(
name: "UpdatedBy",
table: "identity_users",
type: "uuid",
nullable: true,
comment: "最后更新人用户标识,匿名或系统操作时为 null。",
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedAt",
table: "identity_users",
type: "timestamp with time zone",
nullable: true,
comment: "最近一次更新时间UTC从未更新时为 null。",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "TenantId",
table: "identity_users",
type: "uuid",
nullable: false,
comment: "所属租户 ID。",
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<string>(
name: "Roles",
table: "identity_users",
type: "text",
nullable: false,
comment: "角色集合。",
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Permissions",
table: "identity_users",
type: "text",
nullable: false,
comment: "权限集合。",
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "PasswordHash",
table: "identity_users",
type: "character varying(256)",
maxLength: 256,
nullable: false,
comment: "密码哈希。",
oldClrType: typeof(string),
oldType: "character varying(256)",
oldMaxLength: 256);
migrationBuilder.AlterColumn<Guid>(
name: "MerchantId",
table: "identity_users",
type: "uuid",
nullable: true,
comment: "所属商户(平台管理员为空)。",
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DisplayName",
table: "identity_users",
type: "character varying(64)",
maxLength: 64,
nullable: false,
comment: "展示名称。",
oldClrType: typeof(string),
oldType: "character varying(64)",
oldMaxLength: 64);
migrationBuilder.AlterColumn<Guid>(
name: "DeletedBy",
table: "identity_users",
type: "uuid",
nullable: true,
comment: "删除人用户标识(软删除),未删除时为 null。",
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "DeletedAt",
table: "identity_users",
type: "timestamp with time zone",
nullable: true,
comment: "软删除时间UTC未删除时为 null。",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "CreatedBy",
table: "identity_users",
type: "uuid",
nullable: true,
comment: "创建人用户标识,匿名或系统操作时为 null。",
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedAt",
table: "identity_users",
type: "timestamp with time zone",
nullable: false,
comment: "创建时间UTC。",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
migrationBuilder.AlterColumn<string>(
name: "Avatar",
table: "identity_users",
type: "character varying(256)",
maxLength: 256,
nullable: true,
comment: "头像地址。",
oldClrType: typeof(string),
oldType: "character varying(256)",
oldMaxLength: 256,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Account",
table: "identity_users",
type: "character varying(64)",
maxLength: 64,
nullable: false,
comment: "登录账号。",
oldClrType: typeof(string),
oldType: "character varying(64)",
oldMaxLength: 64);
migrationBuilder.AlterColumn<Guid>(
name: "Id",
table: "identity_users",
type: "uuid",
nullable: false,
comment: "实体唯一标识。",
oldClrType: typeof(Guid),
oldType: "uuid");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterTable(
name: "mini_users",
oldComment: "小程序用户实体。");
migrationBuilder.AlterTable(
name: "identity_users",
oldComment: "管理后台账户实体(平台管理员、租户管理员或商户员工)。");
migrationBuilder.AlterColumn<Guid>(
name: "UpdatedBy",
table: "mini_users",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true,
oldComment: "最后更新人用户标识,匿名或系统操作时为 null。");
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedAt",
table: "mini_users",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true,
oldComment: "最近一次更新时间UTC从未更新时为 null。");
migrationBuilder.AlterColumn<string>(
name: "UnionId",
table: "mini_users",
type: "character varying(128)",
maxLength: 128,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128,
oldNullable: true,
oldComment: "微信 UnionId可能为空。");
migrationBuilder.AlterColumn<Guid>(
name: "TenantId",
table: "mini_users",
type: "uuid",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid",
oldComment: "所属租户 ID。");
migrationBuilder.AlterColumn<string>(
name: "OpenId",
table: "mini_users",
type: "character varying(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128,
oldComment: "微信 OpenId。");
migrationBuilder.AlterColumn<string>(
name: "Nickname",
table: "mini_users",
type: "character varying(64)",
maxLength: 64,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(64)",
oldMaxLength: 64,
oldComment: "昵称。");
migrationBuilder.AlterColumn<Guid>(
name: "DeletedBy",
table: "mini_users",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true,
oldComment: "删除人用户标识(软删除),未删除时为 null。");
migrationBuilder.AlterColumn<DateTime>(
name: "DeletedAt",
table: "mini_users",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true,
oldComment: "软删除时间UTC未删除时为 null。");
migrationBuilder.AlterColumn<Guid>(
name: "CreatedBy",
table: "mini_users",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true,
oldComment: "创建人用户标识,匿名或系统操作时为 null。");
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedAt",
table: "mini_users",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldComment: "创建时间UTC。");
migrationBuilder.AlterColumn<string>(
name: "Avatar",
table: "mini_users",
type: "character varying(256)",
maxLength: 256,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(256)",
oldMaxLength: 256,
oldNullable: true,
oldComment: "头像地址。");
migrationBuilder.AlterColumn<Guid>(
name: "Id",
table: "mini_users",
type: "uuid",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid",
oldComment: "实体唯一标识。");
migrationBuilder.AlterColumn<Guid>(
name: "UpdatedBy",
table: "identity_users",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true,
oldComment: "最后更新人用户标识,匿名或系统操作时为 null。");
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedAt",
table: "identity_users",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true,
oldComment: "最近一次更新时间UTC从未更新时为 null。");
migrationBuilder.AlterColumn<Guid>(
name: "TenantId",
table: "identity_users",
type: "uuid",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid",
oldComment: "所属租户 ID。");
migrationBuilder.AlterColumn<string>(
name: "Roles",
table: "identity_users",
type: "text",
nullable: false,
oldClrType: typeof(string),
oldType: "text",
oldComment: "角色集合。");
migrationBuilder.AlterColumn<string>(
name: "Permissions",
table: "identity_users",
type: "text",
nullable: false,
oldClrType: typeof(string),
oldType: "text",
oldComment: "权限集合。");
migrationBuilder.AlterColumn<string>(
name: "PasswordHash",
table: "identity_users",
type: "character varying(256)",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(256)",
oldMaxLength: 256,
oldComment: "密码哈希。");
migrationBuilder.AlterColumn<Guid>(
name: "MerchantId",
table: "identity_users",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true,
oldComment: "所属商户(平台管理员为空)。");
migrationBuilder.AlterColumn<string>(
name: "DisplayName",
table: "identity_users",
type: "character varying(64)",
maxLength: 64,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(64)",
oldMaxLength: 64,
oldComment: "展示名称。");
migrationBuilder.AlterColumn<Guid>(
name: "DeletedBy",
table: "identity_users",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true,
oldComment: "删除人用户标识(软删除),未删除时为 null。");
migrationBuilder.AlterColumn<DateTime>(
name: "DeletedAt",
table: "identity_users",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true,
oldComment: "软删除时间UTC未删除时为 null。");
migrationBuilder.AlterColumn<Guid>(
name: "CreatedBy",
table: "identity_users",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true,
oldComment: "创建人用户标识,匿名或系统操作时为 null。");
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedAt",
table: "identity_users",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldComment: "创建时间UTC。");
migrationBuilder.AlterColumn<string>(
name: "Avatar",
table: "identity_users",
type: "character varying(256)",
maxLength: 256,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(256)",
oldMaxLength: 256,
oldNullable: true,
oldComment: "头像地址。");
migrationBuilder.AlterColumn<string>(
name: "Account",
table: "identity_users",
type: "character varying(64)",
maxLength: 64,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(64)",
oldMaxLength: 64,
oldComment: "登录账号。");
migrationBuilder.AlterColumn<Guid>(
name: "Id",
table: "identity_users",
type: "uuid",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid",
oldComment: "实体唯一标识。");
}
}
}

View File

@@ -26,58 +26,73 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("实体唯一标识。");
b.Property<string>("Account")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
.HasColumnType("character varying(64)")
.HasComment("登录账号。");
b.Property<string>("Avatar")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
.HasColumnType("character varying(256)")
.HasComment("头像地址。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<Guid?>("CreatedBy")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone");
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<Guid?>("DeletedBy")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
.HasColumnType("character varying(64)")
.HasComment("展示名称。");
b.Property<Guid?>("MerchantId")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("所属商户(平台管理员为空)。");
b.Property<string>("PasswordHash")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
.HasColumnType("character varying(256)")
.HasComment("密码哈希。");
b.Property<string>("Permissions")
.IsRequired()
.HasColumnType("text");
.HasColumnType("text")
.HasComment("权限集合。");
b.Property<string>("Roles")
.IsRequired()
.HasColumnType("text");
.HasColumnType("text")
.HasComment("角色集合。");
b.Property<Guid>("TenantId")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("所属租户 ID。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<Guid?>("UpdatedBy")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
@@ -86,53 +101,68 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations
b.HasIndex("TenantId", "Account")
.IsUnique();
b.ToTable("identity_users", (string)null);
b.ToTable("identity_users", null, t =>
{
t.HasComment("管理后台账户实体(平台管理员、租户管理员或商户员工)。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Identity.Entities.MiniUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("实体唯一标识。");
b.Property<string>("Avatar")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
.HasColumnType("character varying(256)")
.HasComment("头像地址。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<Guid?>("CreatedBy")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone");
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<Guid?>("DeletedBy")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("Nickname")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
.HasColumnType("character varying(64)")
.HasComment("昵称。");
b.Property<string>("OpenId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
.HasColumnType("character varying(128)")
.HasComment("微信 OpenId。");
b.Property<Guid>("TenantId")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("所属租户 ID。");
b.Property<string>("UnionId")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
.HasColumnType("character varying(128)")
.HasComment("微信 UnionId可能为空。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<Guid?>("UpdatedBy")
.HasColumnType("uuid");
.HasColumnType("uuid")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
@@ -141,7 +171,10 @@ namespace TakeoutSaaS.Infrastructure.Identity.Migrations
b.HasIndex("TenantId", "OpenId")
.IsUnique();
b.ToTable("mini_users", (string)null);
b.ToTable("mini_users", null, t =>
{
t.HasComment("小程序用户实体。");
});
});
#pragma warning restore 612, 618
}

View File

@@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using TakeoutSaaS.Infrastructure.Common.Persistence.DesignTime;
using TakeoutSaaS.Shared.Abstractions.Constants;
using TakeoutSaaS.Shared.Abstractions.Security;
using TakeoutSaaS.Shared.Abstractions.Tenancy;
@@ -12,7 +13,7 @@ internal sealed class IdentityDesignTimeDbContextFactory
: DesignTimeDbContextFactoryBase<IdentityDbContext>
{
public IdentityDesignTimeDbContextFactory()
: base("TAKEOUTSAAS_IDENTITY_CONNECTION", "takeout_saas_identity")
: base(DatabaseConstants.IdentityDataSource, "TAKEOUTSAAS_IDENTITY_CONNECTION")
{
}