// 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.Dictionary.Persistence; #nullable disable namespace TakeoutSaaS.Infrastructure.Migrations.DictionaryDb { [DbContext(typeof(DictionaryDbContext))] [Migration("20251230232516_AddDictionaryLabelOverrides")] partial class AddDictionaryLabelOverrides { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "10.0.1") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.CacheInvalidationLog", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint") .HasComment("实体唯一标识。"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AffectedCacheKeyCount") .HasColumnType("integer") .HasComment("影响的缓存键数量。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); b.Property("CreatedBy") .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); b.Property("DeletedBy") .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DictionaryCode") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)") .HasComment("字典编码。"); b.Property("Operation") .HasColumnType("integer") .HasComment("操作类型。"); b.Property("OperatorId") .HasColumnType("bigint") .HasComment("操作人用户标识。"); b.Property("Scope") .HasColumnType("integer") .HasComment("字典作用域。"); b.Property("TenantId") .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("Timestamp") .HasColumnType("timestamp with time zone") .HasComment("发生时间(UTC)。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); b.Property("UpdatedBy") .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); b.HasIndex("TenantId", "Timestamp"); b.ToTable("dictionary_cache_invalidation_logs", null, t => { t.HasComment("字典缓存失效日志。"); }); }); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryGroup", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint") .HasComment("实体唯一标识。"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AllowOverride") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasComment("是否允许租户覆盖。"); b.Property("Code") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); b.Property("CreatedBy") .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); b.Property("DeletedBy") .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") .HasMaxLength(512) .HasColumnType("character varying(512)") .HasComment("描述信息。"); b.Property("IsEnabled") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true) .HasComment("是否启用。"); b.Property("Name") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)") .HasComment("分组名称。"); b.Property("RowVersion") .IsConcurrencyToken() .IsRequired() .ValueGeneratedOnAddOrUpdate() .HasColumnType("bytea") .HasComment("并发控制字段。"); b.Property("Scope") .HasColumnType("integer") .HasComment("分组作用域:系统/业务。"); b.Property("TenantId") .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); b.Property("UpdatedBy") .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "Code") .IsUnique() .HasFilter("\"DeletedAt\" IS NULL"); b.HasIndex("TenantId", "Scope", "IsEnabled"); b.ToTable("dictionary_groups", null, t => { t.HasComment("参数字典分组(系统参数、业务参数)。"); }); }); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryImportLog", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint") .HasComment("实体唯一标识。"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ConflictMode") .HasColumnType("integer") .HasComment("冲突处理模式。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); b.Property("CreatedBy") .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); b.Property("DeletedBy") .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("DictionaryGroupCode") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)") .HasComment("字典分组编码。"); b.Property("Duration") .HasColumnType("interval") .HasComment("处理耗时。"); b.Property("ErrorDetails") .HasColumnType("jsonb") .HasComment("错误明细(JSON)。"); b.Property("FileName") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)") .HasComment("导入文件名。"); b.Property("FileSize") .HasColumnType("bigint") .HasComment("文件大小(字节)。"); b.Property("Format") .IsRequired() .HasMaxLength(16) .HasColumnType("character varying(16)") .HasComment("文件格式(CSV/JSON)。"); b.Property("OperatorId") .HasColumnType("bigint") .HasComment("操作人用户标识。"); b.Property("ProcessedAt") .HasColumnType("timestamp with time zone") .HasComment("处理时间(UTC)。"); b.Property("SkipCount") .HasColumnType("integer") .HasComment("跳过数量。"); b.Property("SuccessCount") .HasColumnType("integer") .HasComment("成功导入数量。"); b.Property("TenantId") .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); b.Property("UpdatedBy") .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.HasKey("Id"); b.HasIndex("TenantId", "ProcessedAt"); b.ToTable("dictionary_import_logs", null, t => { t.HasComment("字典导入审计日志。"); }); }); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryItem", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint") .HasComment("实体唯一标识。"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); b.Property("CreatedBy") .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); b.Property("DeletedBy") .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") .HasMaxLength(512) .HasColumnType("character varying(512)") .HasComment("描述信息。"); b.Property("GroupId") .HasColumnType("bigint") .HasComment("关联分组 ID。"); b.Property("IsDefault") .HasColumnType("boolean") .HasComment("是否默认项。"); b.Property("IsEnabled") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true) .HasComment("是否启用。"); b.Property("Key") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)") .HasComment("字典项键。"); b.Property("RowVersion") .IsConcurrencyToken() .IsRequired() .ValueGeneratedOnAddOrUpdate() .HasColumnType("bytea") .HasComment("并发控制字段。"); b.Property("SortOrder") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(100) .HasComment("排序值,越小越靠前。"); b.Property("TenantId") .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); b.Property("UpdatedBy") .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Value") .IsRequired() .HasColumnType("jsonb") .HasComment("字典项值。"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("GroupId", "IsEnabled", "SortOrder"); b.HasIndex("TenantId", "GroupId", "Key") .IsUnique() .HasFilter("\"DeletedAt\" IS NULL"); b.ToTable("dictionary_items", null, t => { t.HasComment("参数字典项。"); }); }); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryLabelOverride", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint") .HasComment("实体唯一标识。"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); b.Property("CreatedBy") .HasColumnType("bigint") .HasComment("创建人用户标识。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("删除时间(UTC)。"); b.Property("DeletedBy") .HasColumnType("bigint") .HasComment("删除人用户标识。"); b.Property("DictionaryItemId") .HasColumnType("bigint") .HasComment("被覆盖的字典项 ID。"); b.Property("OriginalValue") .IsRequired() .HasColumnType("jsonb") .HasComment("原始显示值(JSON 格式,多语言)。"); b.Property("OverrideType") .HasColumnType("integer") .HasComment("覆盖类型。"); b.Property("OverrideValue") .IsRequired() .HasColumnType("jsonb") .HasComment("覆盖后的显示值(JSON 格式,多语言)。"); b.Property("Reason") .HasMaxLength(512) .HasColumnType("character varying(512)") .HasComment("覆盖原因/备注。"); b.Property("TenantId") .HasColumnType("bigint") .HasComment("所属租户 ID(覆盖目标租户)。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近更新时间(UTC)。"); b.Property("UpdatedBy") .HasColumnType("bigint") .HasComment("最后更新人用户标识。"); b.HasKey("Id"); b.HasIndex("DictionaryItemId"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "DictionaryItemId") .IsUnique() .HasFilter("\"DeletedAt\" IS NULL"); b.HasIndex("TenantId", "OverrideType"); b.ToTable("dictionary_label_overrides", null, t => { t.HasComment("字典标签覆盖配置。"); }); }); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.TenantDictionaryOverride", b => { b.Property("TenantId") .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("SystemDictionaryGroupId") .HasColumnType("bigint") .HasComment("系统字典分组 ID。"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); b.Property("CreatedBy") .HasColumnType("bigint") .HasComment("创建人用户标识。"); b.Property("CustomSortOrder") .IsRequired() .HasColumnType("jsonb") .HasComment("自定义排序映射(JSON)。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("删除时间(UTC)。"); b.Property("DeletedBy") .HasColumnType("bigint") .HasComment("删除人用户标识。"); b.PrimitiveCollection("HiddenSystemItemIds") .IsRequired() .HasColumnType("bigint[]") .HasComment("隐藏的系统字典项 ID 列表。"); b.Property("OverrideEnabled") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasComment("是否启用覆盖。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近更新时间(UTC)。"); b.Property("UpdatedBy") .HasColumnType("bigint") .HasComment("最后更新人用户标识。"); b.HasKey("TenantId", "SystemDictionaryGroupId"); b.HasIndex("HiddenSystemItemIds"); NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("HiddenSystemItemIds"), "gin"); b.ToTable("tenant_dictionary_overrides", null, t => { t.HasComment("租户字典覆盖配置。"); }); }); modelBuilder.Entity("TakeoutSaaS.Domain.SystemParameters.Entities.SystemParameter", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint") .HasComment("实体唯一标识。"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasComment("创建时间(UTC)。"); b.Property("CreatedBy") .HasColumnType("bigint") .HasComment("创建人用户标识,匿名或系统操作时为 null。"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone") .HasComment("软删除时间(UTC),未删除时为 null。"); b.Property("DeletedBy") .HasColumnType("bigint") .HasComment("删除人用户标识(软删除),未删除时为 null。"); b.Property("Description") .HasMaxLength(512) .HasColumnType("character varying(512)") .HasComment("描述信息。"); b.Property("IsEnabled") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true) .HasComment("是否启用。"); b.Property("Key") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)") .HasComment("参数键,租户内唯一。"); b.Property("SortOrder") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(100) .HasComment("排序值,越小越靠前。"); b.Property("TenantId") .HasColumnType("bigint") .HasComment("所属租户 ID。"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasComment("最近一次更新时间(UTC),从未更新时为 null。"); b.Property("UpdatedBy") .HasColumnType("bigint") .HasComment("最后更新人用户标识,匿名或系统操作时为 null。"); b.Property("Value") .IsRequired() .HasColumnType("text") .HasComment("参数值,支持文本或 JSON。"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "Key") .IsUnique(); b.ToTable("system_parameters", null, t => { t.HasComment("系统参数实体:支持按租户维护的键值型配置。"); }); }); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryItem", b => { b.HasOne("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryGroup", "Group") .WithMany("Items") .HasForeignKey("GroupId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Group"); }); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryLabelOverride", b => { b.HasOne("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryItem", "DictionaryItem") .WithMany() .HasForeignKey("DictionaryItemId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("DictionaryItem"); }); modelBuilder.Entity("TakeoutSaaS.Domain.Dictionary.Entities.DictionaryGroup", b => { b.Navigation("Items"); }); #pragma warning restore 612, 618 } } }