//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TakeoutSaaS.Infrastructure.App.Persistence;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations
{
[DbContext(typeof(TakeoutAppDbContext))]
partial class TakeoutAppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricAlertRule", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ConditionJson")
.IsRequired()
.HasColumnType("text")
.HasComment("触发条件 JSON。");
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("Enabled")
.HasColumnType("boolean")
.HasComment("是否启用。");
b.Property("MetricDefinitionId")
.HasColumnType("bigint")
.HasComment("关联指标。");
b.Property("NotificationChannels")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("通知渠道。");
b.Property("Severity")
.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", "MetricDefinitionId", "Severity");
b.ToTable("metric_alert_rules", null, t =>
{
t.HasComment("指标告警规则。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricDefinition", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Code")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("指标编码。");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间(UTC)。");
b.Property("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property("DefaultAggregation")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasComment("默认聚合方式。");
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("DimensionsJson")
.HasColumnType("text")
.HasComment("维度描述 JSON。");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.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", "Code")
.IsUnique();
b.ToTable("metric_definitions", null, t =>
{
t.HasComment("指标定义,描述可观测的数据点。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricSnapshot", 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("DimensionKey")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("维度键(JSON)。");
b.Property("MetricDefinitionId")
.HasColumnType("bigint")
.HasComment("指标定义 ID。");
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")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)")
.HasComment("数值。");
b.Property("WindowEnd")
.HasColumnType("timestamp with time zone")
.HasComment("统计时间窗口结束。");
b.Property("WindowStart")
.HasColumnType("timestamp with time zone")
.HasComment("统计时间窗口开始。");
b.HasKey("Id");
b.HasIndex("TenantId", "MetricDefinitionId", "DimensionKey", "WindowStart", "WindowEnd")
.IsUnique();
b.ToTable("metric_snapshots", null, t =>
{
t.HasComment("指标快照,用于大盘展示。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.Coupon", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Code")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasComment("券码或序列号。");
b.Property("CouponTemplateId")
.HasColumnType("bigint")
.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("ExpireAt")
.HasColumnType("timestamp with time zone")
.HasComment("到期时间。");
b.Property("IssuedAt")
.HasColumnType("timestamp with time zone")
.HasComment("发放时间。");
b.Property("OrderId")
.HasColumnType("bigint")
.HasComment("订单 ID(已使用时记录)。");
b.Property("Status")
.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.Property("UsedAt")
.HasColumnType("timestamp with time zone")
.HasComment("使用时间。");
b.Property("UserId")
.HasColumnType("bigint")
.HasComment("归属用户。");
b.HasKey("Id");
b.HasIndex("TenantId", "Code")
.IsUnique();
b.ToTable("coupons", null, t =>
{
t.HasComment("用户领取的券。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.CouponTemplate", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AllowStack")
.HasColumnType("boolean")
.HasComment("是否允许叠加其他优惠。");
b.Property("ChannelsJson")
.HasColumnType("text")
.HasComment("发放渠道(JSON)。");
b.Property("ClaimedQuantity")
.HasColumnType("integer")
.HasComment("已领取数量。");
b.Property("CouponType")
.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("Description")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("备注。");
b.Property("DiscountCap")
.HasColumnType("numeric")
.HasComment("折扣上限(针对折扣券)。");
b.Property("MinimumSpend")
.HasColumnType("numeric")
.HasComment("最低消费门槛。");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("模板名称。");
b.Property("ProductScopeJson")
.HasColumnType("text")
.HasComment("适用品类或商品范围(JSON)。");
b.Property("RelativeValidDays")
.HasColumnType("integer")
.HasComment("有效天数(相对发放时间)。");
b.Property("Status")
.HasColumnType("integer")
.HasComment("状态。");
b.Property("StoreScopeJson")
.HasColumnType("text")
.HasComment("适用门店 ID 集合(JSON)。");
b.Property("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property("TotalQuantity")
.HasColumnType("integer")
.HasComment("总发放数量上限。");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间(UTC),从未更新时为 null。");
b.Property("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.Property("ValidFrom")
.HasColumnType("timestamp with time zone")
.HasComment("可用开始时间。");
b.Property("ValidTo")
.HasColumnType("timestamp with time zone")
.HasComment("可用结束时间。");
b.Property("Value")
.HasColumnType("numeric")
.HasComment("面值或折扣额度。");
b.HasKey("Id");
b.ToTable("coupon_templates", null, t =>
{
t.HasComment("优惠券模板。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.PromotionCampaign", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AudienceDescription")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("目标人群描述。");
b.Property("BannerUrl")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("营销素材(如 banner)。");
b.Property("Budget")
.HasColumnType("numeric")
.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("EndAt")
.HasColumnType("timestamp with time zone")
.HasComment("结束时间。");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("活动名称。");
b.Property("PromotionType")
.HasColumnType("integer")
.HasComment("活动类型。");
b.Property("RulesJson")
.IsRequired()
.HasColumnType("text")
.HasComment("活动规则 JSON。");
b.Property("StartAt")
.HasColumnType("timestamp with time zone")
.HasComment("开始时间。");
b.Property("Status")
.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.ToTable("promotion_campaigns", null, t =>
{
t.HasComment("营销活动配置。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatMessage", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ChatSessionId")
.HasColumnType("bigint")
.HasComment("会话标识。");
b.Property("Content")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasComment("消息内容。");
b.Property("ContentType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.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("IsRead")
.HasColumnType("boolean")
.HasComment("是否已读。");
b.Property("ReadAt")
.HasColumnType("timestamp with time zone")
.HasComment("读取时间。");
b.Property("SenderType")
.HasColumnType("integer")
.HasComment("发送方类型。");
b.Property("SenderUserId")
.HasColumnType("bigint")
.HasComment("发送方用户 ID。");
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", "ChatSessionId", "CreatedAt");
b.ToTable("chat_messages", null, t =>
{
t.HasComment("会话消息。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatSession", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AgentUserId")
.HasColumnType("bigint")
.HasComment("当前客服员工 ID。");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间(UTC)。");
b.Property("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property("CustomerUserId")
.HasColumnType("bigint")
.HasComment("顾客用户 ID。");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间(UTC),未删除时为 null。");
b.Property("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property("EndedAt")
.HasColumnType("timestamp with time zone")
.HasComment("结束时间。");
b.Property("IsBotActive")
.HasColumnType("boolean")
.HasComment("是否机器人接待中。");
b.Property("SessionCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("会话编号。");
b.Property("StartedAt")
.HasColumnType("timestamp with time zone")
.HasComment("开始时间。");
b.Property("Status")
.HasColumnType("integer")
.HasComment("会话状态。");
b.Property("StoreId")
.HasColumnType("bigint")
.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", "SessionCode")
.IsUnique();
b.ToTable("chat_sessions", null, t =>
{
t.HasComment("客服会话。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.SupportTicket", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AssignedAgentId")
.HasColumnType("bigint")
.HasComment("指派的客服。");
b.Property("ClosedAt")
.HasColumnType("timestamp with time zone")
.HasComment("关闭时间。");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间(UTC)。");
b.Property("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property("CustomerUserId")
.HasColumnType("bigint")
.HasComment("客户用户 ID。");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间(UTC),未删除时为 null。");
b.Property("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property("Description")
.IsRequired()
.HasColumnType("text")
.HasComment("工单详情。");
b.Property("OrderId")
.HasColumnType("bigint")
.HasComment("关联订单(如有)。");
b.Property("Priority")
.HasColumnType("integer")
.HasComment("优先级。");
b.Property("Status")
.HasColumnType("integer")
.HasComment("状态。");
b.Property("Subject")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("工单主题。");
b.Property("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property("TicketNo")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasComment("工单编号。");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间(UTC),从未更新时为 null。");
b.Property("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("TenantId", "TicketNo")
.IsUnique();
b.ToTable("support_tickets", null, t =>
{
t.HasComment("客服工单。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.TicketComment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AttachmentsJson")
.HasColumnType("text")
.HasComment("附件 JSON。");
b.Property("AuthorUserId")
.HasColumnType("bigint")
.HasComment("评论人 ID。");
b.Property("Content")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.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("IsInternal")
.HasColumnType("boolean")
.HasComment("是否内部备注。");
b.Property("SupportTicketId")
.HasColumnType("bigint")
.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", "SupportTicketId");
b.ToTable("ticket_comments", null, t =>
{
t.HasComment("工单评论/流转记录。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryEvent", 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("DeliveryOrderId")
.HasColumnType("bigint")
.HasComment("配送单标识。");
b.Property("EventType")
.HasColumnType("integer")
.HasComment("事件类型。");
b.Property("Message")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("事件描述。");
b.Property("OccurredAt")
.HasColumnType("timestamp with time zone")
.HasComment("发生时间。");
b.Property("Payload")
.HasColumnType("text")
.HasComment("原始数据 JSON。");
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", "DeliveryOrderId", "EventType");
b.ToTable("delivery_events", null, t =>
{
t.HasComment("配送状态事件流水。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryOrder", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CourierName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("骑手姓名。");
b.Property("CourierPhone")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.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("DeliveredAt")
.HasColumnType("timestamp with time zone")
.HasComment("完成时间。");
b.Property("DeliveryFee")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.HasComment("配送费。");
b.Property("DispatchedAt")
.HasColumnType("timestamp with time zone")
.HasComment("下发时间。");
b.Property("FailureReason")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("异常原因。");
b.Property("OrderId")
.HasColumnType("bigint")
.HasComment("获取或设置关联订单 ID。");
b.Property("PickedUpAt")
.HasColumnType("timestamp with time zone")
.HasComment("取餐时间。");
b.Property("Provider")
.HasColumnType("integer")
.HasComment("配送服务商。");
b.Property("ProviderOrderId")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("第三方配送单号。");
b.Property("Status")
.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", "OrderId")
.IsUnique();
b.ToTable("delivery_orders", null, t =>
{
t.HasComment("配送单。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliateOrder", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AffiliatePartnerId")
.HasColumnType("bigint")
.HasComment("推广人标识。");
b.Property("BuyerUserId")
.HasColumnType("bigint")
.HasComment("用户 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("EstimatedCommission")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.HasComment("预计佣金。");
b.Property("OrderAmount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.HasComment("订单金额。");
b.Property("OrderId")
.HasColumnType("bigint")
.HasComment("关联订单。");
b.Property("SettledAt")
.HasColumnType("timestamp with time zone")
.HasComment("结算完成时间。");
b.Property("Status")
.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", "AffiliatePartnerId", "OrderId")
.IsUnique();
b.ToTable("affiliate_orders", null, t =>
{
t.HasComment("分销订单记录。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePartner", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ChannelType")
.HasColumnType("integer")
.HasComment("渠道类型。");
b.Property("CommissionRate")
.HasColumnType("numeric")
.HasComment("分成比例(0-1)。");
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("DisplayName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("昵称或渠道名称。");
b.Property("Phone")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasComment("联系电话。");
b.Property("Remarks")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("审核备注。");
b.Property("Status")
.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.Property("UserId")
.HasColumnType("bigint")
.HasComment("用户 ID(如绑定平台账号)。");
b.HasKey("Id");
b.HasIndex("TenantId", "DisplayName");
b.ToTable("affiliate_partners", null, t =>
{
t.HasComment("分销/推广合作伙伴。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePayout", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AffiliatePartnerId")
.HasColumnType("bigint")
.HasComment("合作伙伴标识。");
b.Property("Amount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.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("PaidAt")
.HasColumnType("timestamp with time zone")
.HasComment("打款时间。");
b.Property("Period")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasComment("结算周期描述。");
b.Property("Remarks")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("备注。");
b.Property("Status")
.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", "AffiliatePartnerId", "Period")
.IsUnique();
b.ToTable("affiliate_payouts", null, t =>
{
t.HasComment("佣金结算记录。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInCampaign", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AllowMakeupCount")
.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