2551 lines
208 KiB
C#
2551 lines
208 KiB
C#
using System;
|
||
using Microsoft.EntityFrameworkCore.Migrations;
|
||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||
|
||
#nullable disable
|
||
|
||
namespace TakeoutSaaS.Infrastructure.Migrations
|
||
{
|
||
/// <inheritdoc />
|
||
public partial class InitSnowflake_App : Migration
|
||
{
|
||
/// <inheritdoc />
|
||
protected override void Up(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.CreateTable(
|
||
name: "affiliate_orders",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
AffiliatePartnerId = table.Column<long>(type: "bigint", nullable: false, comment: "推广人标识。"),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: false, comment: "关联订单。"),
|
||
BuyerUserId = table.Column<long>(type: "bigint", nullable: false, comment: "用户 ID。"),
|
||
OrderAmount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "订单金额。"),
|
||
EstimatedCommission = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "预计佣金。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "当前状态。"),
|
||
SettledAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "结算完成时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_affiliate_orders", x => x.Id);
|
||
},
|
||
comment: "分销订单记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "affiliate_partners",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
UserId = table.Column<long>(type: "bigint", nullable: true, comment: "用户 ID(如绑定平台账号)。"),
|
||
DisplayName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "昵称或渠道名称。"),
|
||
Phone = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "联系电话。"),
|
||
ChannelType = table.Column<int>(type: "integer", nullable: false, comment: "渠道类型。"),
|
||
CommissionRate = table.Column<decimal>(type: "numeric", nullable: false, comment: "分成比例(0-1)。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "当前状态。"),
|
||
Remarks = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "审核备注。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_affiliate_partners", x => x.Id);
|
||
},
|
||
comment: "分销/推广合作伙伴。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "affiliate_payouts",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
AffiliatePartnerId = table.Column<long>(type: "bigint", nullable: false, comment: "合作伙伴标识。"),
|
||
Period = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "结算周期描述。"),
|
||
Amount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "结算金额。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
PaidAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "打款时间。"),
|
||
Remarks = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_affiliate_payouts", x => x.Id);
|
||
},
|
||
comment: "佣金结算记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "cart_item_addons",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
CartItemId = table.Column<long>(type: "bigint", nullable: false, comment: "所属购物车条目。"),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "选项名称。"),
|
||
ExtraPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "附加价格。"),
|
||
OptionId = table.Column<long>(type: "bigint", nullable: true, comment: "选项 ID(可对应 ProductAddonOption)。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_cart_item_addons", x => x.Id);
|
||
},
|
||
comment: "购物车条目的加料/附加项。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "cart_items",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
ShoppingCartId = table.Column<long>(type: "bigint", nullable: false, comment: "所属购物车标识。"),
|
||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "商品或 SKU 标识。"),
|
||
ProductSkuId = table.Column<long>(type: "bigint", nullable: true, comment: "SKU 标识。"),
|
||
ProductName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "商品名称快照。"),
|
||
UnitPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "单价快照。"),
|
||
Quantity = table.Column<int>(type: "integer", nullable: false, comment: "数量。"),
|
||
Remark = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "自定义备注(口味要求)。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
AttributesJson = table.Column<string>(type: "text", nullable: true, comment: "扩展 JSON(规格、加料选项等)。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_cart_items", x => x.Id);
|
||
},
|
||
comment: "购物车条目。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "chat_messages",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
ChatSessionId = table.Column<long>(type: "bigint", nullable: false, comment: "会话标识。"),
|
||
SenderType = table.Column<int>(type: "integer", nullable: false, comment: "发送方类型。"),
|
||
SenderUserId = table.Column<long>(type: "bigint", nullable: true, comment: "发送方用户 ID。"),
|
||
Content = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "消息内容。"),
|
||
ContentType = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "消息类型(文字/图片/语音等)。"),
|
||
IsRead = table.Column<bool>(type: "boolean", nullable: false, comment: "是否已读。"),
|
||
ReadAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "读取时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_chat_messages", x => x.Id);
|
||
},
|
||
comment: "会话消息。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "chat_sessions",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
SessionCode = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "会话编号。"),
|
||
CustomerUserId = table.Column<long>(type: "bigint", nullable: false, comment: "顾客用户 ID。"),
|
||
AgentUserId = table.Column<long>(type: "bigint", nullable: true, comment: "当前客服员工 ID。"),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: true, comment: "所属门店(可空为平台)。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "会话状态。"),
|
||
IsBotActive = table.Column<bool>(type: "boolean", nullable: false, comment: "是否机器人接待中。"),
|
||
StartedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "开始时间。"),
|
||
EndedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "结束时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_chat_sessions", x => x.Id);
|
||
},
|
||
comment: "客服会话。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "checkin_campaigns",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "活动名称。"),
|
||
Description = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "活动描述。"),
|
||
StartDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "开始日期。"),
|
||
EndDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "结束日期。"),
|
||
AllowMakeupCount = table.Column<int>(type: "integer", nullable: false, comment: "支持补签次数。"),
|
||
RewardsJson = table.Column<string>(type: "text", nullable: false, comment: "连签奖励 JSON。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_checkin_campaigns", x => x.Id);
|
||
},
|
||
comment: "签到活动配置。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "checkin_records",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
CheckInCampaignId = table.Column<long>(type: "bigint", nullable: false, comment: "活动标识。"),
|
||
UserId = table.Column<long>(type: "bigint", nullable: false, comment: "用户标识。"),
|
||
CheckInDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "签到日期(本地)。"),
|
||
IsMakeup = table.Column<bool>(type: "boolean", nullable: false, comment: "是否补签。"),
|
||
RewardJson = table.Column<string>(type: "text", nullable: false, comment: "获得奖励 JSON。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_checkin_records", x => x.Id);
|
||
},
|
||
comment: "用户签到记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "checkout_sessions",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
UserId = table.Column<long>(type: "bigint", nullable: false, comment: "用户标识。"),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
SessionToken = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "会话 Token。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "会话状态。"),
|
||
ValidationResultJson = table.Column<string>(type: "text", nullable: false, comment: "校验结果明细 JSON。"),
|
||
ExpiresAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "过期时间(UTC)。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_checkout_sessions", x => x.Id);
|
||
},
|
||
comment: "结账会话,记录校验上下文。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "community_comments",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
PostId = table.Column<long>(type: "bigint", nullable: false, comment: "动态标识。"),
|
||
AuthorUserId = table.Column<long>(type: "bigint", nullable: false, comment: "评论人。"),
|
||
Content = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false, comment: "评论内容。"),
|
||
ParentId = table.Column<long>(type: "bigint", nullable: true, comment: "父级评论 ID。"),
|
||
IsDeleted = table.Column<bool>(type: "boolean", nullable: false, comment: "状态。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_community_comments", x => x.Id);
|
||
},
|
||
comment: "社区评论。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "community_posts",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
AuthorUserId = table.Column<long>(type: "bigint", nullable: false, comment: "作者用户 ID。"),
|
||
Title = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, comment: "标题。"),
|
||
Content = table.Column<string>(type: "text", nullable: false, comment: "内容。"),
|
||
MediaJson = table.Column<string>(type: "text", nullable: true, comment: "媒体资源 JSON。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
LikeCount = table.Column<int>(type: "integer", nullable: false, comment: "点赞数。"),
|
||
CommentCount = table.Column<int>(type: "integer", nullable: false, comment: "评论数。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_community_posts", x => x.Id);
|
||
},
|
||
comment: "社区动态。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "community_reactions",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
PostId = table.Column<long>(type: "bigint", nullable: false, comment: "动态 ID。"),
|
||
UserId = table.Column<long>(type: "bigint", nullable: false, comment: "用户 ID。"),
|
||
ReactionType = table.Column<int>(type: "integer", nullable: false, comment: "反应类型。"),
|
||
ReactedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "时间戳。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_community_reactions", x => x.Id);
|
||
},
|
||
comment: "社区互动反馈。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "coupon_templates",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "模板名称。"),
|
||
CouponType = table.Column<int>(type: "integer", nullable: false, comment: "券类型。"),
|
||
Value = table.Column<decimal>(type: "numeric", nullable: false, comment: "面值或折扣额度。"),
|
||
DiscountCap = table.Column<decimal>(type: "numeric", nullable: true, comment: "折扣上限(针对折扣券)。"),
|
||
MinimumSpend = table.Column<decimal>(type: "numeric", nullable: true, comment: "最低消费门槛。"),
|
||
ValidFrom = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "可用开始时间。"),
|
||
ValidTo = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "可用结束时间。"),
|
||
RelativeValidDays = table.Column<int>(type: "integer", nullable: true, comment: "有效天数(相对发放时间)。"),
|
||
TotalQuantity = table.Column<int>(type: "integer", nullable: true, comment: "总发放数量上限。"),
|
||
ClaimedQuantity = table.Column<int>(type: "integer", nullable: false, comment: "已领取数量。"),
|
||
StoreScopeJson = table.Column<string>(type: "text", nullable: true, comment: "适用门店 ID 集合(JSON)。"),
|
||
ProductScopeJson = table.Column<string>(type: "text", nullable: true, comment: "适用品类或商品范围(JSON)。"),
|
||
ChannelsJson = table.Column<string>(type: "text", nullable: true, comment: "发放渠道(JSON)。"),
|
||
AllowStack = table.Column<bool>(type: "boolean", nullable: false, comment: "是否允许叠加其他优惠。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
Description = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_coupon_templates", x => x.Id);
|
||
},
|
||
comment: "优惠券模板。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "coupons",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
CouponTemplateId = table.Column<long>(type: "bigint", nullable: false, comment: "模板标识。"),
|
||
Code = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "券码或序列号。"),
|
||
UserId = table.Column<long>(type: "bigint", nullable: false, comment: "归属用户。"),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: true, comment: "订单 ID(已使用时记录)。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
IssuedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "发放时间。"),
|
||
UsedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "使用时间。"),
|
||
ExpireAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "到期时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_coupons", x => x.Id);
|
||
},
|
||
comment: "用户领取的券。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "delivery_events",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
DeliveryOrderId = table.Column<long>(type: "bigint", nullable: false, comment: "配送单标识。"),
|
||
EventType = table.Column<int>(type: "integer", nullable: false, comment: "事件类型。"),
|
||
Message = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false, comment: "事件描述。"),
|
||
Payload = table.Column<string>(type: "text", nullable: true, comment: "原始数据 JSON。"),
|
||
OccurredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "发生时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_delivery_events", x => x.Id);
|
||
},
|
||
comment: "配送状态事件流水。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "delivery_orders",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: false),
|
||
Provider = table.Column<int>(type: "integer", nullable: false, comment: "配送服务商。"),
|
||
ProviderOrderId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "第三方配送单号。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
DeliveryFee = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "配送费。"),
|
||
CourierName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "骑手姓名。"),
|
||
CourierPhone = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "骑手电话。"),
|
||
DispatchedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "下发时间。"),
|
||
PickedUpAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "取餐时间。"),
|
||
DeliveredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "完成时间。"),
|
||
FailureReason = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "异常原因。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_delivery_orders", x => x.Id);
|
||
},
|
||
comment: "配送单。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "group_orders",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "关联商品或套餐。"),
|
||
GroupOrderNo = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "拼单编号。"),
|
||
LeaderUserId = table.Column<long>(type: "bigint", nullable: false, comment: "团长用户 ID。"),
|
||
TargetCount = table.Column<int>(type: "integer", nullable: false, comment: "成团需要的人数。"),
|
||
CurrentCount = table.Column<int>(type: "integer", nullable: false, comment: "当前已参与人数。"),
|
||
GroupPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "拼团价格。"),
|
||
StartAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "开始时间。"),
|
||
EndAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "结束时间。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "拼团状态。"),
|
||
SucceededAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "成团时间。"),
|
||
CancelledAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "取消时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_group_orders", x => x.Id);
|
||
},
|
||
comment: "拼单活动。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "group_participants",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
GroupOrderId = table.Column<long>(type: "bigint", nullable: false, comment: "拼单活动标识。"),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: false, comment: "对应订单标识。"),
|
||
UserId = table.Column<long>(type: "bigint", nullable: false, comment: "用户标识。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "参与状态。"),
|
||
JoinedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "参与时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_group_participants", x => x.Id);
|
||
},
|
||
comment: "拼单参与者。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "inventory_adjustments",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
InventoryItemId = table.Column<long>(type: "bigint", nullable: false, comment: "对应的库存记录标识。"),
|
||
AdjustmentType = table.Column<int>(type: "integer", nullable: false, comment: "调整类型。"),
|
||
Quantity = table.Column<int>(type: "integer", nullable: false, comment: "调整数量,正数增加,负数减少。"),
|
||
Reason = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "原因说明。"),
|
||
OperatorId = table.Column<long>(type: "bigint", nullable: true, comment: "操作人标识。"),
|
||
OccurredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "发生时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_inventory_adjustments", x => x.Id);
|
||
},
|
||
comment: "库存调整记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "inventory_batches",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
ProductSkuId = table.Column<long>(type: "bigint", nullable: false, comment: "SKU 标识。"),
|
||
BatchNumber = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "批次编号。"),
|
||
ProductionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "生产日期。"),
|
||
ExpireDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "过期日期。"),
|
||
Quantity = table.Column<int>(type: "integer", nullable: false, comment: "入库数量。"),
|
||
RemainingQuantity = table.Column<int>(type: "integer", nullable: false, comment: "剩余数量。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_inventory_batches", x => x.Id);
|
||
},
|
||
comment: "SKU 批次信息。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "inventory_items",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
ProductSkuId = table.Column<long>(type: "bigint", nullable: false, comment: "SKU 标识。"),
|
||
BatchNumber = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "批次编号,可为空表示混批。"),
|
||
QuantityOnHand = table.Column<int>(type: "integer", nullable: false, comment: "可用库存。"),
|
||
QuantityReserved = table.Column<int>(type: "integer", nullable: false, comment: "已锁定库存(订单占用)。"),
|
||
SafetyStock = table.Column<int>(type: "integer", nullable: true, comment: "安全库存阈值。"),
|
||
Location = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "储位或仓位信息。"),
|
||
ExpireDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "过期日期。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_inventory_items", x => x.Id);
|
||
},
|
||
comment: "SKU 在门店的库存信息。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "map_locations",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: true, comment: "关联门店 ID,可空表示独立 POI。"),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "名称。"),
|
||
Address = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false, comment: "地址。"),
|
||
Longitude = table.Column<double>(type: "double precision", nullable: false, comment: "经度。"),
|
||
Latitude = table.Column<double>(type: "double precision", nullable: false, comment: "纬度。"),
|
||
Landmark = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, comment: "打车/导航落点描述。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_map_locations", x => x.Id);
|
||
},
|
||
comment: "地图 POI 信息,用于门店定位和推荐。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "member_growth_logs",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
MemberId = table.Column<long>(type: "bigint", nullable: false, comment: "会员标识。"),
|
||
ChangeValue = table.Column<int>(type: "integer", nullable: false, comment: "变动数量。"),
|
||
CurrentValue = table.Column<int>(type: "integer", nullable: false, comment: "当前成长值。"),
|
||
Notes = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"),
|
||
OccurredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "发生时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_member_growth_logs", x => x.Id);
|
||
},
|
||
comment: "成长值变动日志。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "member_point_ledgers",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
MemberId = table.Column<long>(type: "bigint", nullable: false, comment: "会员标识。"),
|
||
ChangeAmount = table.Column<int>(type: "integer", nullable: false, comment: "变动数量,可为负值。"),
|
||
BalanceAfterChange = table.Column<int>(type: "integer", nullable: false, comment: "变动后余额。"),
|
||
Reason = table.Column<int>(type: "integer", nullable: false, comment: "变动原因。"),
|
||
SourceId = table.Column<long>(type: "bigint", nullable: true, comment: "来源 ID(订单、活动等)。"),
|
||
OccurredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "发生时间。"),
|
||
ExpireAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "过期时间(如适用)。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_member_point_ledgers", x => x.Id);
|
||
},
|
||
comment: "积分变动流水。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "member_profiles",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
UserId = table.Column<long>(type: "bigint", nullable: false, comment: "用户标识。"),
|
||
Mobile = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "手机号。"),
|
||
Nickname = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "昵称。"),
|
||
AvatarUrl = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "头像。"),
|
||
MemberTierId = table.Column<long>(type: "bigint", nullable: true, comment: "当前会员等级 ID。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "会员状态。"),
|
||
PointsBalance = table.Column<int>(type: "integer", nullable: false, comment: "会员积分余额。"),
|
||
GrowthValue = table.Column<int>(type: "integer", nullable: false, comment: "成长值/经验值。"),
|
||
BirthDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "生日。"),
|
||
JoinedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "注册时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_member_profiles", x => x.Id);
|
||
},
|
||
comment: "会员档案。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "member_tiers",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "等级名称。"),
|
||
RequiredGrowth = table.Column<int>(type: "integer", nullable: false, comment: "所需成长值。"),
|
||
BenefitsJson = table.Column<string>(type: "text", nullable: false, comment: "等级权益(JSON)。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序值。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_member_tiers", x => x.Id);
|
||
},
|
||
comment: "会员等级定义。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "merchant_contracts",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
MerchantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属商户标识。"),
|
||
ContractNumber = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "合同编号。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "合同状态。"),
|
||
StartDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "合同开始时间。"),
|
||
EndDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "合同结束时间。"),
|
||
FileUrl = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false, comment: "合同文件存储地址。"),
|
||
SignedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "签署时间。"),
|
||
TerminatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "终止时间。"),
|
||
TerminationReason = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "终止原因。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_merchant_contracts", x => x.Id);
|
||
},
|
||
comment: "商户合同记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "merchant_documents",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
MerchantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属商户标识。"),
|
||
DocumentType = table.Column<int>(type: "integer", nullable: false, comment: "证照类型。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "审核状态。"),
|
||
FileUrl = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false, comment: "证照文件链接。"),
|
||
DocumentNumber = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "证照编号。"),
|
||
IssuedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "签发日期。"),
|
||
ExpiresAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "到期日期。"),
|
||
Remarks = table.Column<string>(type: "text", nullable: true, comment: "审核备注或驳回原因。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_merchant_documents", x => x.Id);
|
||
},
|
||
comment: "商户提交的资质或证照材料。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "merchant_staff",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
MerchantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属商户标识。"),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: true, comment: "可选的关联门店 ID。"),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "员工姓名。"),
|
||
Phone = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "手机号。"),
|
||
Email = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, comment: "邮箱地址。"),
|
||
IdentityUserId = table.Column<long>(type: "bigint", nullable: true, comment: "登录账号 ID(指向统一身份体系)。"),
|
||
RoleType = table.Column<int>(type: "integer", nullable: false, comment: "员工角色类型。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "员工状态。"),
|
||
PermissionsJson = table.Column<string>(type: "text", nullable: true, comment: "自定义权限(JSON)。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_merchant_staff", x => x.Id);
|
||
},
|
||
comment: "商户员工账号,支持门店维度分配。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "merchants",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
BrandName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "品牌名称(对外展示)。"),
|
||
BrandAlias = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "品牌简称或别名。"),
|
||
LogoUrl = table.Column<string>(type: "text", nullable: true, comment: "品牌 Logo。"),
|
||
Category = table.Column<string>(type: "text", nullable: true, comment: "品牌所属品类,如火锅、咖啡等。"),
|
||
BusinessLicenseNumber = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "营业执照号。"),
|
||
BusinessLicenseImageUrl = table.Column<string>(type: "text", nullable: true, comment: "营业执照扫描件地址。"),
|
||
TaxNumber = table.Column<string>(type: "text", nullable: true, comment: "税号/统一社会信用代码。"),
|
||
LegalPerson = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "法人或负责人姓名。"),
|
||
ContactPhone = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "联系电话。"),
|
||
ContactEmail = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, comment: "联系邮箱。"),
|
||
ServicePhone = table.Column<string>(type: "text", nullable: true, comment: "客服电话。"),
|
||
SupportEmail = table.Column<string>(type: "text", nullable: true, comment: "客服邮箱。"),
|
||
Province = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在省份。"),
|
||
City = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在城市。"),
|
||
District = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在区县。"),
|
||
Address = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "详细地址。"),
|
||
Longitude = table.Column<double>(type: "double precision", nullable: true, comment: "经度信息。"),
|
||
Latitude = table.Column<double>(type: "double precision", nullable: true, comment: "纬度信息。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "入驻状态。"),
|
||
ReviewRemarks = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "审核备注或驳回原因。"),
|
||
JoinedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "入驻时间。"),
|
||
LastReviewedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次审核时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_merchants", x => x.Id);
|
||
},
|
||
comment: "商户主体信息,承载入驻和资质审核结果。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "metric_alert_rules",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
MetricDefinitionId = table.Column<long>(type: "bigint", nullable: false, comment: "关联指标。"),
|
||
ConditionJson = table.Column<string>(type: "text", nullable: false, comment: "触发条件 JSON。"),
|
||
Severity = table.Column<int>(type: "integer", nullable: false, comment: "告警级别。"),
|
||
NotificationChannels = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false, comment: "通知渠道。"),
|
||
Enabled = table.Column<bool>(type: "boolean", nullable: false, comment: "是否启用。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_metric_alert_rules", x => x.Id);
|
||
},
|
||
comment: "指标告警规则。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "metric_definitions",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
Code = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "指标编码。"),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "指标名称。"),
|
||
Description = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "说明。"),
|
||
DimensionsJson = table.Column<string>(type: "text", nullable: true, comment: "维度描述 JSON。"),
|
||
DefaultAggregation = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "默认聚合方式。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_metric_definitions", x => x.Id);
|
||
},
|
||
comment: "指标定义,描述可观测的数据点。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "metric_snapshots",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
MetricDefinitionId = table.Column<long>(type: "bigint", nullable: false, comment: "指标定义 ID。"),
|
||
DimensionKey = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false, comment: "维度键(JSON)。"),
|
||
WindowStart = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "统计时间窗口开始。"),
|
||
WindowEnd = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "统计时间窗口结束。"),
|
||
Value = table.Column<decimal>(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false, comment: "数值。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_metric_snapshots", x => x.Id);
|
||
},
|
||
comment: "指标快照,用于大盘展示。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "navigation_requests",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
UserId = table.Column<long>(type: "bigint", nullable: false, comment: "用户 ID。"),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店 ID。"),
|
||
Channel = table.Column<int>(type: "integer", nullable: false, comment: "来源通道(小程序、H5 等)。"),
|
||
TargetApp = table.Column<int>(type: "integer", nullable: false, comment: "跳转的地图应用。"),
|
||
RequestedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "请求时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_navigation_requests", x => x.Id);
|
||
},
|
||
comment: "用户发起的导航请求日志。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "order_status_histories",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: false, comment: "订单标识。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "变更后的状态。"),
|
||
OperatorId = table.Column<long>(type: "bigint", nullable: true, comment: "操作人标识(可为空表示系统)。"),
|
||
Notes = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注信息。"),
|
||
OccurredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "发生时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_order_status_histories", x => x.Id);
|
||
},
|
||
comment: "订单状态流转记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "orders",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
OrderNo = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "订单号。"),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店。"),
|
||
Channel = table.Column<int>(type: "integer", nullable: false, comment: "下单渠道。"),
|
||
DeliveryType = table.Column<int>(type: "integer", nullable: false, comment: "履约类型。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "当前状态。"),
|
||
PaymentStatus = table.Column<int>(type: "integer", nullable: false, comment: "支付状态。"),
|
||
CustomerName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "顾客姓名。"),
|
||
CustomerPhone = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "顾客手机号。"),
|
||
TableNo = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "就餐桌号。"),
|
||
QueueNumber = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "排队号(如有)。"),
|
||
ReservationId = table.Column<long>(type: "bigint", nullable: true, comment: "预约 ID。"),
|
||
ItemsAmount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "商品总额。"),
|
||
DiscountAmount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "优惠金额。"),
|
||
PayableAmount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "应付金额。"),
|
||
PaidAmount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "实付金额。"),
|
||
PaidAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "支付时间。"),
|
||
FinishedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "完成时间。"),
|
||
CancelledAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "取消时间。"),
|
||
CancelReason = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "取消原因。"),
|
||
Remark = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_orders", x => x.Id);
|
||
},
|
||
comment: "交易订单。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "payment_records",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: false, comment: "关联订单。"),
|
||
Method = table.Column<int>(type: "integer", nullable: false, comment: "支付方式。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "支付状态。"),
|
||
Amount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "支付金额。"),
|
||
TradeNo = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "平台交易号。"),
|
||
ChannelTransactionId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "第三方渠道单号。"),
|
||
PaidAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "支付完成时间。"),
|
||
Remark = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "错误/备注。"),
|
||
Payload = table.Column<string>(type: "text", nullable: true, comment: "原始回调内容。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_payment_records", x => x.Id);
|
||
},
|
||
comment: "支付流水。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "payment_refund_records",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
PaymentRecordId = table.Column<long>(type: "bigint", nullable: false, comment: "原支付记录标识。"),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: false, comment: "关联订单标识。"),
|
||
Amount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "退款金额。"),
|
||
ChannelRefundId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "渠道退款流水号。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "退款状态。"),
|
||
RequestedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "退款请求时间。"),
|
||
CompletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "完成时间。"),
|
||
Payload = table.Column<string>(type: "text", nullable: true, comment: "渠道返回的原始数据 JSON。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_payment_refund_records", x => x.Id);
|
||
},
|
||
comment: "支付渠道退款流水。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "product_addon_groups",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "所属商品。"),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分组名称。"),
|
||
SelectionType = table.Column<int>(type: "integer", nullable: false, comment: "选择类型。"),
|
||
MinSelect = table.Column<int>(type: "integer", nullable: true, comment: "最小选择数量。"),
|
||
MaxSelect = table.Column<int>(type: "integer", nullable: true, comment: "最大选择数量。"),
|
||
IsRequired = table.Column<bool>(type: "boolean", nullable: false, comment: "是否必选。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序值。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_product_addon_groups", x => x.Id);
|
||
},
|
||
comment: "加料/做法分组。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "product_addon_options",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
AddonGroupId = table.Column<long>(type: "bigint", nullable: false, comment: "所属加料分组。"),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "选项名称。"),
|
||
ExtraPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "附加价格。"),
|
||
IsDefault = table.Column<bool>(type: "boolean", nullable: false, comment: "是否默认选项。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_product_addon_options", x => x.Id);
|
||
},
|
||
comment: "加料选项。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "product_attribute_groups",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: true, comment: "关联门店,可为空表示所有门店共享。"),
|
||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "所属商品标识。"),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分组名称,例如“辣度”“份量”。"),
|
||
SelectionType = table.Column<int>(type: "integer", nullable: false, comment: "选择类型(单选/多选)。"),
|
||
IsRequired = table.Column<bool>(type: "boolean", nullable: false, comment: "是否必选。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "显示排序。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_product_attribute_groups", x => x.Id);
|
||
},
|
||
comment: "商品规格/属性分组。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "product_attribute_options",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
AttributeGroupId = table.Column<long>(type: "bigint", nullable: false, comment: "所属规格组。"),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "选项名称。"),
|
||
ExtraPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "附加价格。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序。"),
|
||
IsDefault = table.Column<bool>(type: "boolean", nullable: false, comment: "是否默认选中。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_product_attribute_options", x => x.Id);
|
||
},
|
||
comment: "商品规格选项。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "product_categories",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "所属门店。"),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分类名称。"),
|
||
Description = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "分类描述。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序值。"),
|
||
IsEnabled = table.Column<bool>(type: "boolean", nullable: false, comment: "是否启用。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_product_categories", x => x.Id);
|
||
},
|
||
comment: "商品分类。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "product_media_assets",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "商品标识。"),
|
||
MediaType = table.Column<int>(type: "integer", nullable: false, comment: "媒体类型。"),
|
||
Url = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false, comment: "媒资链接。"),
|
||
Caption = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "描述或标题。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_product_media_assets", x => x.Id);
|
||
},
|
||
comment: "商品媒资素材。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "product_pricing_rules",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "所属商品。"),
|
||
RuleType = table.Column<int>(type: "integer", nullable: false, comment: "策略类型。"),
|
||
ConditionsJson = table.Column<string>(type: "text", nullable: false, comment: "条件描述(JSON),如会员等级、渠道等。"),
|
||
Price = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "特殊价格。"),
|
||
StartTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "生效开始时间。"),
|
||
EndTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "生效结束时间。"),
|
||
WeekdaysJson = table.Column<string>(type: "text", nullable: true, comment: "生效星期(JSON 数组)。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序值。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_product_pricing_rules", x => x.Id);
|
||
},
|
||
comment: "商品价格策略,支持会员价/时段价等。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "product_skus",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "所属商品标识。"),
|
||
SkuCode = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "SKU 编码。"),
|
||
Barcode = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "条形码。"),
|
||
Price = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "售价。"),
|
||
OriginalPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "原价。"),
|
||
StockQuantity = table.Column<int>(type: "integer", nullable: true, comment: "可售库存。"),
|
||
Weight = table.Column<decimal>(type: "numeric(10,3)", precision: 10, scale: 3, nullable: true, comment: "重量(千克)。"),
|
||
AttributesJson = table.Column<string>(type: "text", nullable: false, comment: "规格属性 JSON(记录选项 ID)。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序值。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_product_skus", x => x.Id);
|
||
},
|
||
comment: "商品 SKU,记录具体规格组合价格。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "products",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "所属门店。"),
|
||
CategoryId = table.Column<long>(type: "bigint", nullable: false, comment: "所属分类。"),
|
||
SpuCode = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "商品编码。"),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "商品名称。"),
|
||
Subtitle = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "副标题/卖点。"),
|
||
Unit = table.Column<string>(type: "character varying(16)", maxLength: 16, nullable: true, comment: "售卖单位(份/杯等)。"),
|
||
Price = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "现价。"),
|
||
OriginalPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "原价。"),
|
||
StockQuantity = table.Column<int>(type: "integer", nullable: true, comment: "库存数量(可选)。"),
|
||
MaxQuantityPerOrder = table.Column<int>(type: "integer", nullable: true, comment: "最大每单限购。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "商品状态。"),
|
||
CoverImage = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "主图。"),
|
||
GalleryImages = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true, comment: "Gallery 图片逗号分隔。"),
|
||
Description = table.Column<string>(type: "text", nullable: true, comment: "商品描述。"),
|
||
EnableDineIn = table.Column<bool>(type: "boolean", nullable: false, comment: "支持堂食。"),
|
||
EnablePickup = table.Column<bool>(type: "boolean", nullable: false, comment: "支持自提。"),
|
||
EnableDelivery = table.Column<bool>(type: "boolean", nullable: false, comment: "支持配送。"),
|
||
IsFeatured = table.Column<bool>(type: "boolean", nullable: false, comment: "是否热门推荐。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_products", x => x.Id);
|
||
},
|
||
comment: "商品(SPU)信息。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "promotion_campaigns",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "活动名称。"),
|
||
PromotionType = table.Column<int>(type: "integer", nullable: false, comment: "活动类型。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "活动状态。"),
|
||
StartAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "开始时间。"),
|
||
EndAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "结束时间。"),
|
||
Budget = table.Column<decimal>(type: "numeric", nullable: true, comment: "预算金额。"),
|
||
RulesJson = table.Column<string>(type: "text", nullable: false, comment: "活动规则 JSON。"),
|
||
AudienceDescription = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "目标人群描述。"),
|
||
BannerUrl = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "营销素材(如 banner)。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_promotion_campaigns", x => x.Id);
|
||
},
|
||
comment: "营销活动配置。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "queue_tickets",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false),
|
||
TicketNumber = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "排队编号。"),
|
||
PartySize = table.Column<int>(type: "integer", nullable: false, comment: "就餐人数。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
EstimatedWaitMinutes = table.Column<int>(type: "integer", nullable: true, comment: "预计等待分钟。"),
|
||
CalledAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "叫号时间。"),
|
||
ExpiredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "过号时间。"),
|
||
CancelledAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "取消时间。"),
|
||
Remark = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_queue_tickets", x => x.Id);
|
||
},
|
||
comment: "排队叫号。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "refund_requests",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: false, comment: "关联订单标识。"),
|
||
RefundNo = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "退款单号。"),
|
||
Amount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "申请金额。"),
|
||
Reason = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false, comment: "申请原因。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "退款状态。"),
|
||
RequestedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "用户提交时间。"),
|
||
ProcessedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "审核完成时间。"),
|
||
ReviewNotes = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "审核备注。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_refund_requests", x => x.Id);
|
||
},
|
||
comment: "售后/退款申请。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "reservations",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店。"),
|
||
ReservationNo = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "预约号。"),
|
||
CustomerName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "客户姓名。"),
|
||
CustomerPhone = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "联系电话。"),
|
||
PeopleCount = table.Column<int>(type: "integer", nullable: false, comment: "用餐人数。"),
|
||
ReservationTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "预约时间(UTC)。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
TablePreference = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "桌型/标签。"),
|
||
Remark = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注。"),
|
||
CheckInCode = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "核销码/到店码。"),
|
||
CheckedInAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "实际签到时间。"),
|
||
CancelledAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "取消时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_reservations", x => x.Id);
|
||
},
|
||
comment: "预约/预订记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "shopping_carts",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
UserId = table.Column<long>(type: "bigint", nullable: false, comment: "用户标识。"),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "购物车状态,包含正常/锁定。"),
|
||
TableContext = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "桌码或场景标识(扫码点餐)。"),
|
||
DeliveryPreference = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "履约方式(堂食/自提/配送)缓存。"),
|
||
LastModifiedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "最近一次修改时间(UTC)。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_shopping_carts", x => x.Id);
|
||
},
|
||
comment: "用户购物车,按租户/门店隔离。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "store_business_hours",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
DayOfWeek = table.Column<int>(type: "integer", nullable: false, comment: "星期几,0 表示周日。"),
|
||
HourType = table.Column<int>(type: "integer", nullable: false, comment: "时段类型(正常营业、休息、预约等)。"),
|
||
StartTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "开始时间(本地时间)。"),
|
||
EndTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "结束时间(本地时间)。"),
|
||
CapacityLimit = table.Column<int>(type: "integer", nullable: true, comment: "最大接待容量或单量限制。"),
|
||
Notes = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_store_business_hours", x => x.Id);
|
||
},
|
||
comment: "门店营业时段配置。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "store_delivery_zones",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
ZoneName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "区域名称。"),
|
||
PolygonGeoJson = table.Column<string>(type: "text", nullable: false, comment: "GeoJSON 表示的多边形范围。"),
|
||
MinimumOrderAmount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "起送价。"),
|
||
DeliveryFee = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true, comment: "配送费。"),
|
||
EstimatedMinutes = table.Column<int>(type: "integer", nullable: true, comment: "预计送达分钟。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序值。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_store_delivery_zones", x => x.Id);
|
||
},
|
||
comment: "门店配送范围配置。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "store_employee_shifts",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
StaffId = table.Column<long>(type: "bigint", nullable: false, comment: "员工标识。"),
|
||
ShiftDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "班次日期。"),
|
||
StartTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "开始时间。"),
|
||
EndTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "结束时间。"),
|
||
RoleType = table.Column<int>(type: "integer", nullable: false, comment: "排班角色。"),
|
||
Notes = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "备注。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_store_employee_shifts", x => x.Id);
|
||
},
|
||
comment: "门店员工排班记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "store_holidays",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "日期。"),
|
||
IsClosed = table.Column<bool>(type: "boolean", nullable: false, comment: "是否全天闭店。"),
|
||
Reason = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "说明内容。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_store_holidays", x => x.Id);
|
||
},
|
||
comment: "门店休息日或特殊营业日。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "store_table_areas",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "区域名称。"),
|
||
Description = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "区域描述。"),
|
||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序值。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_store_table_areas", x => x.Id);
|
||
},
|
||
comment: "门店桌台区域配置。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "store_tables",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店标识。"),
|
||
AreaId = table.Column<long>(type: "bigint", nullable: true, comment: "所在区域 ID。"),
|
||
TableCode = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "桌码。"),
|
||
Capacity = table.Column<int>(type: "integer", nullable: false, comment: "可容纳人数。"),
|
||
Tags = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, comment: "桌台标签(堂食、快餐等)。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "当前桌台状态。"),
|
||
QrCodeUrl = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "桌码二维码地址。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_store_tables", x => x.Id);
|
||
},
|
||
comment: "桌台信息与二维码绑定。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "stores",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
MerchantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属商户标识。"),
|
||
Code = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "门店编码,便于扫码及外部对接。"),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "门店名称。"),
|
||
Phone = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "联系电话。"),
|
||
ManagerName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "门店负责人姓名。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "门店当前运营状态。"),
|
||
Country = table.Column<string>(type: "text", nullable: true, comment: "所在国家或地区。"),
|
||
Province = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在省份。"),
|
||
City = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所在城市。"),
|
||
District = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "区县信息。"),
|
||
Address = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "详细地址。"),
|
||
Longitude = table.Column<double>(type: "double precision", nullable: true, comment: "高德/腾讯地图经度。"),
|
||
Latitude = table.Column<double>(type: "double precision", nullable: true, comment: "纬度。"),
|
||
Description = table.Column<string>(type: "text", nullable: true, comment: "门店描述或公告。"),
|
||
BusinessHours = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "门店营业时段描述(备用字符串)。"),
|
||
SupportsDineIn = table.Column<bool>(type: "boolean", nullable: false, comment: "是否支持堂食。"),
|
||
SupportsPickup = table.Column<bool>(type: "boolean", nullable: false, comment: "是否支持自提。"),
|
||
SupportsDelivery = table.Column<bool>(type: "boolean", nullable: false, comment: "是否支持配送。"),
|
||
SupportsReservation = table.Column<bool>(type: "boolean", nullable: false, comment: "支持预约。"),
|
||
SupportsQueueing = table.Column<bool>(type: "boolean", nullable: false, comment: "支持排队叫号。"),
|
||
DeliveryRadiusKm = table.Column<decimal>(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false, comment: "默认配送半径(公里)。"),
|
||
Announcement = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "门店公告。"),
|
||
Tags = table.Column<string>(type: "text", nullable: true, comment: "门店标签(逗号分隔)。"),
|
||
CoverImageUrl = table.Column<string>(type: "text", nullable: true, comment: "门店海报。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_stores", x => x.Id);
|
||
},
|
||
comment: "门店信息,承载营业配置与能力。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "support_tickets",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
TicketNo = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "工单编号。"),
|
||
CustomerUserId = table.Column<long>(type: "bigint", nullable: false, comment: "客户用户 ID。"),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: true, comment: "关联订单(如有)。"),
|
||
Subject = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "工单主题。"),
|
||
Description = table.Column<string>(type: "text", nullable: false, comment: "工单详情。"),
|
||
Priority = table.Column<int>(type: "integer", nullable: false, comment: "优先级。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "状态。"),
|
||
AssignedAgentId = table.Column<long>(type: "bigint", nullable: true, comment: "指派的客服。"),
|
||
ClosedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "关闭时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_support_tickets", x => x.Id);
|
||
},
|
||
comment: "客服工单。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "tenant_billing_statements",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
StatementNo = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "账单编号,供对账查询。"),
|
||
PeriodStart = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "账单周期开始时间。"),
|
||
PeriodEnd = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "账单周期结束时间。"),
|
||
AmountDue = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "应付金额。"),
|
||
AmountPaid = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "实付金额。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "当前付款状态。"),
|
||
DueDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "到期日。"),
|
||
LineItemsJson = table.Column<string>(type: "text", nullable: true, comment: "账单明细 JSON,记录各项费用。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_tenant_billing_statements", x => x.Id);
|
||
},
|
||
comment: "租户账单,用于呈现周期性收费。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "tenant_notifications",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
Title = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "通知标题。"),
|
||
Message = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "通知正文。"),
|
||
Channel = table.Column<int>(type: "integer", nullable: false, comment: "发布通道(站内、邮件、短信等)。"),
|
||
Severity = table.Column<int>(type: "integer", nullable: false, comment: "通知重要级别。"),
|
||
SentAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "推送时间。"),
|
||
ReadAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "租户是否已阅读。"),
|
||
MetadataJson = table.Column<string>(type: "text", nullable: true, comment: "附加元数据 JSON。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_tenant_notifications", x => x.Id);
|
||
},
|
||
comment: "面向租户的站内通知或消息推送。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "tenant_packages",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "套餐名称,展示给租户的简称。"),
|
||
Description = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "套餐描述,包含适用场景、权益等。"),
|
||
PackageType = table.Column<int>(type: "integer", nullable: false, comment: "套餐分类(试用、标准、旗舰等)。"),
|
||
MonthlyPrice = table.Column<decimal>(type: "numeric", nullable: true, comment: "月付价格,单位:人民币元。"),
|
||
YearlyPrice = table.Column<decimal>(type: "numeric", nullable: true, comment: "年付价格,单位:人民币元。"),
|
||
MaxStoreCount = table.Column<int>(type: "integer", nullable: true, comment: "允许的最大门店数。"),
|
||
MaxAccountCount = table.Column<int>(type: "integer", nullable: true, comment: "允许创建的最大账号数。"),
|
||
MaxStorageGb = table.Column<int>(type: "integer", nullable: true, comment: "存储容量上限(GB)。"),
|
||
MaxSmsCredits = table.Column<int>(type: "integer", nullable: true, comment: "每月短信额度上限。"),
|
||
MaxDeliveryOrders = table.Column<int>(type: "integer", nullable: true, comment: "每月可调用的配送单数量上限。"),
|
||
FeaturePoliciesJson = table.Column<string>(type: "text", nullable: true, comment: "权益明细 JSON,记录自定义特性开关。"),
|
||
IsActive = table.Column<bool>(type: "boolean", nullable: false, comment: "是否仍可售卖。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_tenant_packages", x => x.Id);
|
||
},
|
||
comment: "平台提供的租户套餐定义。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "tenant_quota_usages",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
QuotaType = table.Column<int>(type: "integer", nullable: false, comment: "配额类型,例如门店数、短信条数等。"),
|
||
LimitValue = table.Column<decimal>(type: "numeric", nullable: false, comment: "当前配额上限。"),
|
||
UsedValue = table.Column<decimal>(type: "numeric", nullable: false, comment: "已消耗的数量。"),
|
||
ResetCycle = table.Column<string>(type: "text", nullable: true, comment: "配额刷新周期描述(如月、年)。"),
|
||
LastResetAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次重置时间。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_tenant_quota_usages", x => x.Id);
|
||
},
|
||
comment: "租户配额使用情况快照。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "tenant_subscriptions",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
TenantPackageId = table.Column<long>(type: "bigint", nullable: false, comment: "当前订阅关联的套餐标识。"),
|
||
EffectiveFrom = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "订阅生效时间(UTC)。"),
|
||
EffectiveTo = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "订阅到期时间(UTC)。"),
|
||
NextBillingDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "下一个计费时间,配合自动续费使用。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "订阅当前状态。"),
|
||
AutoRenew = table.Column<bool>(type: "boolean", nullable: false, comment: "是否开启自动续费。"),
|
||
ScheduledPackageId = table.Column<long>(type: "bigint", nullable: true, comment: "若已排期升降配,对应的新套餐 ID。"),
|
||
Notes = table.Column<string>(type: "text", nullable: true, comment: "运营备注信息。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_tenant_subscriptions", x => x.Id);
|
||
},
|
||
comment: "租户套餐订阅记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "tenants",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
Code = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "租户短编码,作为跨系统引用的唯一标识。"),
|
||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "租户全称或品牌名称。"),
|
||
ShortName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "对外展示的简称。"),
|
||
LegalEntityName = table.Column<string>(type: "text", nullable: true, comment: "法人或公司主体名称。"),
|
||
Industry = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "所属行业,如餐饮、零售等。"),
|
||
LogoUrl = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true, comment: "LOGO 图片地址。"),
|
||
CoverImageUrl = table.Column<string>(type: "text", nullable: true, comment: "品牌海报或封面图。"),
|
||
Website = table.Column<string>(type: "text", nullable: true, comment: "官网或主要宣传链接。"),
|
||
Country = table.Column<string>(type: "text", nullable: true, comment: "所在国家/地区。"),
|
||
Province = table.Column<string>(type: "text", nullable: true, comment: "所在省份或州。"),
|
||
City = table.Column<string>(type: "text", nullable: true, comment: "所在城市。"),
|
||
Address = table.Column<string>(type: "text", nullable: true, comment: "详细地址信息。"),
|
||
ContactName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true, comment: "主联系人姓名。"),
|
||
ContactPhone = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true, comment: "主联系人电话。"),
|
||
ContactEmail = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, comment: "主联系人邮箱。"),
|
||
PrimaryOwnerUserId = table.Column<long>(type: "bigint", nullable: true, comment: "系统内对应的租户所有者账号 ID。"),
|
||
Status = table.Column<int>(type: "integer", nullable: false, comment: "租户当前状态,涵盖审核、启用、停用等场景。"),
|
||
EffectiveFrom = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "服务生效时间(UTC)。"),
|
||
EffectiveTo = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "服务到期时间(UTC)。"),
|
||
SuspendedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次暂停服务时间。"),
|
||
SuspensionReason = table.Column<string>(type: "text", nullable: true, comment: "暂停或终止的原因说明。"),
|
||
Tags = table.Column<string>(type: "text", nullable: true, comment: "业务标签集合(逗号分隔)。"),
|
||
Remarks = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注信息,用于运营记录特殊说明。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_tenants", x => x.Id);
|
||
},
|
||
comment: "平台租户信息,描述租户的生命周期与基础资料。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "ticket_comments",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
SupportTicketId = table.Column<long>(type: "bigint", nullable: false, comment: "工单标识。"),
|
||
AuthorUserId = table.Column<long>(type: "bigint", nullable: true, comment: "评论人 ID。"),
|
||
Content = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "评论内容。"),
|
||
IsInternal = table.Column<bool>(type: "boolean", nullable: false, comment: "是否内部备注。"),
|
||
AttachmentsJson = table.Column<string>(type: "text", nullable: true, comment: "附件 JSON。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_ticket_comments", x => x.Id);
|
||
},
|
||
comment: "工单评论/流转记录。");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "order_items",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
OrderId = table.Column<long>(type: "bigint", nullable: false, comment: "订单 ID。"),
|
||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "商品 ID。"),
|
||
ProductName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, comment: "商品名称。"),
|
||
SkuName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true, comment: "SKU/规格描述。"),
|
||
Unit = table.Column<string>(type: "character varying(16)", maxLength: 16, nullable: true, comment: "单位。"),
|
||
Quantity = table.Column<int>(type: "integer", nullable: false, comment: "数量。"),
|
||
UnitPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "单价。"),
|
||
DiscountAmount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "折扣金额。"),
|
||
SubTotal = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "小计。"),
|
||
AttributesJson = table.Column<string>(type: "text", nullable: true, comment: "自定义属性 JSON。"),
|
||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"),
|
||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"),
|
||
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"),
|
||
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
|
||
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
|
||
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
|
||
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_order_items", x => x.Id);
|
||
table.ForeignKey(
|
||
name: "FK_order_items_orders_OrderId",
|
||
column: x => x.OrderId,
|
||
principalTable: "orders",
|
||
principalColumn: "Id",
|
||
onDelete: ReferentialAction.Cascade);
|
||
},
|
||
comment: "订单明细。");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_affiliate_orders_TenantId_AffiliatePartnerId_OrderId",
|
||
table: "affiliate_orders",
|
||
columns: new[] { "TenantId", "AffiliatePartnerId", "OrderId" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_affiliate_partners_TenantId_DisplayName",
|
||
table: "affiliate_partners",
|
||
columns: new[] { "TenantId", "DisplayName" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_affiliate_payouts_TenantId_AffiliatePartnerId_Period",
|
||
table: "affiliate_payouts",
|
||
columns: new[] { "TenantId", "AffiliatePartnerId", "Period" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_cart_items_TenantId_ShoppingCartId",
|
||
table: "cart_items",
|
||
columns: new[] { "TenantId", "ShoppingCartId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_chat_messages_TenantId_ChatSessionId_CreatedAt",
|
||
table: "chat_messages",
|
||
columns: new[] { "TenantId", "ChatSessionId", "CreatedAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_chat_sessions_TenantId_SessionCode",
|
||
table: "chat_sessions",
|
||
columns: new[] { "TenantId", "SessionCode" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_checkin_campaigns_TenantId_Name",
|
||
table: "checkin_campaigns",
|
||
columns: new[] { "TenantId", "Name" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_checkin_records_TenantId_CheckInCampaignId_UserId_CheckInDa~",
|
||
table: "checkin_records",
|
||
columns: new[] { "TenantId", "CheckInCampaignId", "UserId", "CheckInDate" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_checkout_sessions_TenantId_SessionToken",
|
||
table: "checkout_sessions",
|
||
columns: new[] { "TenantId", "SessionToken" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_community_comments_TenantId_PostId_CreatedAt",
|
||
table: "community_comments",
|
||
columns: new[] { "TenantId", "PostId", "CreatedAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_community_posts_TenantId_AuthorUserId_CreatedAt",
|
||
table: "community_posts",
|
||
columns: new[] { "TenantId", "AuthorUserId", "CreatedAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_community_reactions_TenantId_PostId_UserId",
|
||
table: "community_reactions",
|
||
columns: new[] { "TenantId", "PostId", "UserId" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_coupons_TenantId_Code",
|
||
table: "coupons",
|
||
columns: new[] { "TenantId", "Code" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_delivery_events_TenantId_DeliveryOrderId_EventType",
|
||
table: "delivery_events",
|
||
columns: new[] { "TenantId", "DeliveryOrderId", "EventType" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_delivery_orders_TenantId_OrderId",
|
||
table: "delivery_orders",
|
||
columns: new[] { "TenantId", "OrderId" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_group_orders_TenantId_GroupOrderNo",
|
||
table: "group_orders",
|
||
columns: new[] { "TenantId", "GroupOrderNo" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_group_participants_TenantId_GroupOrderId_UserId",
|
||
table: "group_participants",
|
||
columns: new[] { "TenantId", "GroupOrderId", "UserId" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_inventory_adjustments_TenantId_InventoryItemId_OccurredAt",
|
||
table: "inventory_adjustments",
|
||
columns: new[] { "TenantId", "InventoryItemId", "OccurredAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_inventory_batches_TenantId_StoreId_ProductSkuId_BatchNumber",
|
||
table: "inventory_batches",
|
||
columns: new[] { "TenantId", "StoreId", "ProductSkuId", "BatchNumber" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_inventory_items_TenantId_StoreId_ProductSkuId_BatchNumber",
|
||
table: "inventory_items",
|
||
columns: new[] { "TenantId", "StoreId", "ProductSkuId", "BatchNumber" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_map_locations_TenantId_StoreId",
|
||
table: "map_locations",
|
||
columns: new[] { "TenantId", "StoreId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_member_growth_logs_TenantId_MemberId_OccurredAt",
|
||
table: "member_growth_logs",
|
||
columns: new[] { "TenantId", "MemberId", "OccurredAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_member_point_ledgers_TenantId_MemberId_OccurredAt",
|
||
table: "member_point_ledgers",
|
||
columns: new[] { "TenantId", "MemberId", "OccurredAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_member_profiles_TenantId_Mobile",
|
||
table: "member_profiles",
|
||
columns: new[] { "TenantId", "Mobile" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_member_tiers_TenantId_Name",
|
||
table: "member_tiers",
|
||
columns: new[] { "TenantId", "Name" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_merchant_contracts_TenantId_MerchantId_ContractNumber",
|
||
table: "merchant_contracts",
|
||
columns: new[] { "TenantId", "MerchantId", "ContractNumber" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_merchant_documents_TenantId_MerchantId_DocumentType",
|
||
table: "merchant_documents",
|
||
columns: new[] { "TenantId", "MerchantId", "DocumentType" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_merchant_staff_TenantId_MerchantId_Phone",
|
||
table: "merchant_staff",
|
||
columns: new[] { "TenantId", "MerchantId", "Phone" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_merchants_TenantId",
|
||
table: "merchants",
|
||
column: "TenantId");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_metric_alert_rules_TenantId_MetricDefinitionId_Severity",
|
||
table: "metric_alert_rules",
|
||
columns: new[] { "TenantId", "MetricDefinitionId", "Severity" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_metric_definitions_TenantId_Code",
|
||
table: "metric_definitions",
|
||
columns: new[] { "TenantId", "Code" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_metric_snapshots_TenantId_MetricDefinitionId_DimensionKey_W~",
|
||
table: "metric_snapshots",
|
||
columns: new[] { "TenantId", "MetricDefinitionId", "DimensionKey", "WindowStart", "WindowEnd" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_navigation_requests_TenantId_UserId_StoreId_RequestedAt",
|
||
table: "navigation_requests",
|
||
columns: new[] { "TenantId", "UserId", "StoreId", "RequestedAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_order_items_OrderId",
|
||
table: "order_items",
|
||
column: "OrderId");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_order_items_TenantId_OrderId",
|
||
table: "order_items",
|
||
columns: new[] { "TenantId", "OrderId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_order_status_histories_TenantId_OrderId_OccurredAt",
|
||
table: "order_status_histories",
|
||
columns: new[] { "TenantId", "OrderId", "OccurredAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_orders_TenantId_OrderNo",
|
||
table: "orders",
|
||
columns: new[] { "TenantId", "OrderNo" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_orders_TenantId_StoreId_Status",
|
||
table: "orders",
|
||
columns: new[] { "TenantId", "StoreId", "Status" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_payment_records_TenantId_OrderId",
|
||
table: "payment_records",
|
||
columns: new[] { "TenantId", "OrderId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_payment_refund_records_TenantId_PaymentRecordId",
|
||
table: "payment_refund_records",
|
||
columns: new[] { "TenantId", "PaymentRecordId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_product_addon_groups_TenantId_ProductId_Name",
|
||
table: "product_addon_groups",
|
||
columns: new[] { "TenantId", "ProductId", "Name" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_product_attribute_groups_TenantId_StoreId_Name",
|
||
table: "product_attribute_groups",
|
||
columns: new[] { "TenantId", "StoreId", "Name" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_product_attribute_options_TenantId_AttributeGroupId_Name",
|
||
table: "product_attribute_options",
|
||
columns: new[] { "TenantId", "AttributeGroupId", "Name" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_product_categories_TenantId_StoreId",
|
||
table: "product_categories",
|
||
columns: new[] { "TenantId", "StoreId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_product_pricing_rules_TenantId_ProductId_RuleType",
|
||
table: "product_pricing_rules",
|
||
columns: new[] { "TenantId", "ProductId", "RuleType" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_product_skus_TenantId_SkuCode",
|
||
table: "product_skus",
|
||
columns: new[] { "TenantId", "SkuCode" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_products_TenantId_SpuCode",
|
||
table: "products",
|
||
columns: new[] { "TenantId", "SpuCode" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_products_TenantId_StoreId",
|
||
table: "products",
|
||
columns: new[] { "TenantId", "StoreId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_queue_tickets_TenantId_StoreId",
|
||
table: "queue_tickets",
|
||
columns: new[] { "TenantId", "StoreId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_queue_tickets_TenantId_StoreId_TicketNumber",
|
||
table: "queue_tickets",
|
||
columns: new[] { "TenantId", "StoreId", "TicketNumber" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_refund_requests_TenantId_RefundNo",
|
||
table: "refund_requests",
|
||
columns: new[] { "TenantId", "RefundNo" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_reservations_TenantId_ReservationNo",
|
||
table: "reservations",
|
||
columns: new[] { "TenantId", "ReservationNo" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_reservations_TenantId_StoreId",
|
||
table: "reservations",
|
||
columns: new[] { "TenantId", "StoreId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_shopping_carts_TenantId_UserId_StoreId",
|
||
table: "shopping_carts",
|
||
columns: new[] { "TenantId", "UserId", "StoreId" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_store_business_hours_TenantId_StoreId_DayOfWeek",
|
||
table: "store_business_hours",
|
||
columns: new[] { "TenantId", "StoreId", "DayOfWeek" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_store_delivery_zones_TenantId_StoreId_ZoneName",
|
||
table: "store_delivery_zones",
|
||
columns: new[] { "TenantId", "StoreId", "ZoneName" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_store_employee_shifts_TenantId_StoreId_ShiftDate_StaffId",
|
||
table: "store_employee_shifts",
|
||
columns: new[] { "TenantId", "StoreId", "ShiftDate", "StaffId" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_store_holidays_TenantId_StoreId_Date",
|
||
table: "store_holidays",
|
||
columns: new[] { "TenantId", "StoreId", "Date" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_store_table_areas_TenantId_StoreId_Name",
|
||
table: "store_table_areas",
|
||
columns: new[] { "TenantId", "StoreId", "Name" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_store_tables_TenantId_StoreId_TableCode",
|
||
table: "store_tables",
|
||
columns: new[] { "TenantId", "StoreId", "TableCode" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_stores_TenantId_Code",
|
||
table: "stores",
|
||
columns: new[] { "TenantId", "Code" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_stores_TenantId_MerchantId",
|
||
table: "stores",
|
||
columns: new[] { "TenantId", "MerchantId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_support_tickets_TenantId_TicketNo",
|
||
table: "support_tickets",
|
||
columns: new[] { "TenantId", "TicketNo" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_tenant_billing_statements_TenantId_StatementNo",
|
||
table: "tenant_billing_statements",
|
||
columns: new[] { "TenantId", "StatementNo" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_tenant_notifications_TenantId_Channel_SentAt",
|
||
table: "tenant_notifications",
|
||
columns: new[] { "TenantId", "Channel", "SentAt" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_tenant_quota_usages_TenantId_QuotaType",
|
||
table: "tenant_quota_usages",
|
||
columns: new[] { "TenantId", "QuotaType" },
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_tenant_subscriptions_TenantId_TenantPackageId",
|
||
table: "tenant_subscriptions",
|
||
columns: new[] { "TenantId", "TenantPackageId" });
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_tenants_Code",
|
||
table: "tenants",
|
||
column: "Code",
|
||
unique: true);
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_ticket_comments_TenantId_SupportTicketId",
|
||
table: "ticket_comments",
|
||
columns: new[] { "TenantId", "SupportTicketId" });
|
||
}
|
||
|
||
/// <inheritdoc />
|
||
protected override void Down(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.DropTable(
|
||
name: "affiliate_orders");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "affiliate_partners");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "affiliate_payouts");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "cart_item_addons");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "cart_items");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "chat_messages");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "chat_sessions");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "checkin_campaigns");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "checkin_records");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "checkout_sessions");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "community_comments");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "community_posts");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "community_reactions");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "coupon_templates");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "coupons");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "delivery_events");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "delivery_orders");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "group_orders");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "group_participants");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "inventory_adjustments");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "inventory_batches");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "inventory_items");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "map_locations");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "member_growth_logs");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "member_point_ledgers");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "member_profiles");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "member_tiers");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "merchant_contracts");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "merchant_documents");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "merchant_staff");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "merchants");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "metric_alert_rules");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "metric_definitions");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "metric_snapshots");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "navigation_requests");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "order_items");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "order_status_histories");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "payment_records");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "payment_refund_records");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "product_addon_groups");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "product_addon_options");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "product_attribute_groups");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "product_attribute_options");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "product_categories");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "product_media_assets");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "product_pricing_rules");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "product_skus");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "products");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "promotion_campaigns");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "queue_tickets");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "refund_requests");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "reservations");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "shopping_carts");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "store_business_hours");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "store_delivery_zones");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "store_employee_shifts");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "store_holidays");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "store_table_areas");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "store_tables");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "stores");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "support_tickets");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "tenant_billing_statements");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "tenant_notifications");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "tenant_packages");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "tenant_quota_usages");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "tenant_subscriptions");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "tenants");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "ticket_comments");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "orders");
|
||
}
|
||
}
|
||
}
|