//
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.App.Persistence;
#nullable disable
namespace TakeoutSaaS.Infrastructure.App.Migrations
{
[DbContext(typeof(TakeoutAppDbContext))]
[Migration("20251201055852_ExpandDomainSchema")]
partial class ExpandDomainSchema
{
///
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.Analytics.Entities.MetricAlertRule", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ConditionJson")
.IsRequired()
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("Enabled")
.HasColumnType("boolean");
b.Property("MetricDefinitionId")
.HasColumnType("uuid");
b.Property("NotificationChannels")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("Severity")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "MetricDefinitionId", "Severity");
b.ToTable("metric_alert_rules", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricDefinition", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Code")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DefaultAggregation")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("Description")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("DimensionsJson")
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "Code")
.IsUnique();
b.ToTable("metric_definitions", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Analytics.Entities.MetricSnapshot", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("DimensionKey")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("MetricDefinitionId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("Value")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property("WindowEnd")
.HasColumnType("timestamp with time zone");
b.Property("WindowStart")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("TenantId", "MetricDefinitionId", "DimensionKey", "WindowStart", "WindowEnd")
.IsUnique();
b.ToTable("metric_snapshots", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.Coupon", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Code")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("CouponTemplateId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("ExpireAt")
.HasColumnType("timestamp with time zone");
b.Property("IssuedAt")
.HasColumnType("timestamp with time zone");
b.Property("OrderId")
.HasColumnType("uuid");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("UsedAt")
.HasColumnType("timestamp with time zone");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "Code")
.IsUnique();
b.ToTable("coupons", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.CouponTemplate", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AllowStack")
.HasColumnType("boolean");
b.Property("ChannelsJson")
.HasColumnType("text");
b.Property("ClaimedQuantity")
.HasColumnType("integer");
b.Property("CouponType")
.HasColumnType("integer");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("Description")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("DiscountCap")
.HasColumnType("numeric");
b.Property("MinimumSpend")
.HasColumnType("numeric");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("ProductScopeJson")
.HasColumnType("text");
b.Property("RelativeValidDays")
.HasColumnType("integer");
b.Property("Status")
.HasColumnType("integer");
b.Property("StoreScopeJson")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("TotalQuantity")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("ValidFrom")
.HasColumnType("timestamp with time zone");
b.Property("ValidTo")
.HasColumnType("timestamp with time zone");
b.Property("Value")
.HasColumnType("numeric");
b.HasKey("Id");
b.ToTable("coupon_templates", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Coupons.Entities.PromotionCampaign", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AudienceDescription")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("BannerUrl")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("Budget")
.HasColumnType("numeric");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("EndAt")
.HasColumnType("timestamp with time zone");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("PromotionType")
.HasColumnType("integer");
b.Property("RulesJson")
.IsRequired()
.HasColumnType("text");
b.Property("StartAt")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.ToTable("promotion_campaigns", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatMessage", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ChatSessionId")
.HasColumnType("uuid");
b.Property("Content")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)");
b.Property("ContentType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("IsRead")
.HasColumnType("boolean");
b.Property("ReadAt")
.HasColumnType("timestamp with time zone");
b.Property("SenderType")
.HasColumnType("integer");
b.Property("SenderUserId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "ChatSessionId", "CreatedAt");
b.ToTable("chat_messages", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.ChatSession", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AgentUserId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CustomerUserId")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("EndedAt")
.HasColumnType("timestamp with time zone");
b.Property("IsBotActive")
.HasColumnType("boolean");
b.Property("SessionCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("StartedAt")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.HasColumnType("integer");
b.Property("StoreId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "SessionCode")
.IsUnique();
b.ToTable("chat_sessions", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.SupportTicket", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AssignedAgentId")
.HasColumnType("uuid");
b.Property("ClosedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CustomerUserId")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("OrderId")
.HasColumnType("uuid");
b.Property("Priority")
.HasColumnType("integer");
b.Property("Status")
.HasColumnType("integer");
b.Property("Subject")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("TicketNo")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "TicketNo")
.IsUnique();
b.ToTable("support_tickets", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.CustomerService.Entities.TicketComment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AttachmentsJson")
.HasColumnType("text");
b.Property("AuthorUserId")
.HasColumnType("uuid");
b.Property("Content")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("IsInternal")
.HasColumnType("boolean");
b.Property("SupportTicketId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "SupportTicketId");
b.ToTable("ticket_comments", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryEvent", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("DeliveryOrderId")
.HasColumnType("uuid");
b.Property("EventType")
.HasColumnType("integer");
b.Property("Message")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("OccurredAt")
.HasColumnType("timestamp with time zone");
b.Property("Payload")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "DeliveryOrderId", "EventType");
b.ToTable("delivery_events", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Deliveries.Entities.DeliveryOrder", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CourierName")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("CourierPhone")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("DeliveredAt")
.HasColumnType("timestamp with time zone");
b.Property("DeliveryFee")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property("DispatchedAt")
.HasColumnType("timestamp with time zone");
b.Property("FailureReason")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("OrderId")
.HasColumnType("uuid");
b.Property("PickedUpAt")
.HasColumnType("timestamp with time zone");
b.Property("Provider")
.HasColumnType("integer");
b.Property("ProviderOrderId")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "OrderId")
.IsUnique();
b.ToTable("delivery_orders", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliateOrder", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AffiliatePartnerId")
.HasColumnType("uuid");
b.Property("BuyerUserId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("EstimatedCommission")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property("OrderAmount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property("OrderId")
.HasColumnType("uuid");
b.Property("SettledAt")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "AffiliatePartnerId", "OrderId")
.IsUnique();
b.ToTable("affiliate_orders", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePartner", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ChannelType")
.HasColumnType("integer");
b.Property("CommissionRate")
.HasColumnType("numeric");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("DisplayName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Phone")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("Remarks")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "DisplayName");
b.ToTable("affiliate_partners", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Distribution.Entities.AffiliatePayout", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AffiliatePartnerId")
.HasColumnType("uuid");
b.Property("Amount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("PaidAt")
.HasColumnType("timestamp with time zone");
b.Property("Period")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("Remarks")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "AffiliatePartnerId", "Period")
.IsUnique();
b.ToTable("affiliate_payouts", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInCampaign", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AllowMakeupCount")
.HasColumnType("integer");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeletedBy")
.HasColumnType("uuid");
b.Property("Description")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("EndDate")
.HasColumnType("timestamp with time zone");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("RewardsJson")
.IsRequired()
.HasColumnType("text");
b.Property("StartDate")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("checkin_campaigns", (string)null);
});
modelBuilder.Entity("TakeoutSaaS.Domain.Engagement.Entities.CheckInRecord", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CheckInCampaignId")
.HasColumnType("uuid");
b.Property("CheckInDate")
.HasColumnType("timestamp with time zone");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property