feat(product): complete combo and detail editing data model
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 47s

This commit is contained in:
2026-02-22 09:35:57 +08:00
parent f7c2ae4bac
commit d66879f5cf
22 changed files with 19099 additions and 75 deletions

View File

@@ -0,0 +1,96 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddProductComboGroups : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "product_combo_group_items",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ComboGroupId = table.Column<long>(type: "bigint", nullable: false, comment: "所属套餐分组 ID。"),
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "商品 ID。"),
Quantity = table.Column<int>(type: "integer", 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_combo_group_items", x => x.Id);
},
comment: "套餐分组内商品。");
migrationBuilder.CreateTable(
name: "product_combo_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: "套餐商品 ID。"),
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分组名称。"),
MinSelect = table.Column<int>(type: "integer", nullable: false, comment: "最小选择数。"),
MaxSelect = table.Column<int>(type: "integer", 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_combo_groups", x => x.Id);
},
comment: "套餐分组。");
migrationBuilder.CreateIndex(
name: "IX_product_combo_group_items_TenantId_ComboGroupId_ProductId",
table: "product_combo_group_items",
columns: new[] { "TenantId", "ComboGroupId", "ProductId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_product_combo_group_items_TenantId_ComboGroupId_SortOrder",
table: "product_combo_group_items",
columns: new[] { "TenantId", "ComboGroupId", "SortOrder" });
migrationBuilder.CreateIndex(
name: "IX_product_combo_groups_TenantId_ProductId_Name",
table: "product_combo_groups",
columns: new[] { "TenantId", "ProductId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_product_combo_groups_TenantId_ProductId_SortOrder",
table: "product_combo_groups",
columns: new[] { "TenantId", "ProductId", "SortOrder" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "product_combo_group_items");
migrationBuilder.DropTable(
name: "product_combo_groups");
}
}
}