feat: 套餐发布状态与可见/可购开关

This commit is contained in:
2025-12-15 17:29:41 +08:00
parent e6a66b109a
commit 2778a4ebdf
15 changed files with 7022 additions and 9 deletions

View File

@@ -0,0 +1,107 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTenantPackagePublishAndVisibility : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "LogoUrl",
table: "tenants",
type: "text",
nullable: true,
comment: "LOGO 图片地址。",
oldClrType: typeof(string),
oldType: "character varying(256)",
oldMaxLength: 256,
oldNullable: true,
oldComment: "LOGO 图片地址。");
migrationBuilder.AlterColumn<bool>(
name: "IsActive",
table: "tenant_packages",
type: "boolean",
nullable: false,
comment: "是否仍启用(平台控制)。",
oldClrType: typeof(bool),
oldType: "boolean",
oldComment: "是否仍可售卖。");
migrationBuilder.AddColumn<bool>(
name: "IsAllowNewTenantPurchase",
table: "tenant_packages",
type: "boolean",
nullable: false,
defaultValue: true,
comment: "是否允许新租户购买/选择(仅影响新购)。");
migrationBuilder.AddColumn<bool>(
name: "IsPublicVisible",
table: "tenant_packages",
type: "boolean",
nullable: false,
defaultValue: true,
comment: "是否对外可见(展示页/套餐列表可见性)。");
migrationBuilder.AddColumn<int>(
name: "PublishStatus",
table: "tenant_packages",
type: "integer",
nullable: false,
defaultValue: 1,
comment: "发布状态0=草稿1=已发布。");
migrationBuilder.CreateIndex(
name: "IX_tenant_packages_PublishStatus_IsActive_IsPublicVisible_IsAl~",
table: "tenant_packages",
columns: new[] { "PublishStatus", "IsActive", "IsPublicVisible", "IsAllowNewTenantPurchase", "SortOrder" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_tenant_packages_PublishStatus_IsActive_IsPublicVisible_IsAl~",
table: "tenant_packages");
migrationBuilder.DropColumn(
name: "IsAllowNewTenantPurchase",
table: "tenant_packages");
migrationBuilder.DropColumn(
name: "IsPublicVisible",
table: "tenant_packages");
migrationBuilder.DropColumn(
name: "PublishStatus",
table: "tenant_packages");
migrationBuilder.AlterColumn<string>(
name: "LogoUrl",
table: "tenants",
type: "character varying(256)",
maxLength: 256,
nullable: true,
comment: "LOGO 图片地址。",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true,
oldComment: "LOGO 图片地址。");
migrationBuilder.AlterColumn<bool>(
name: "IsActive",
table: "tenant_packages",
type: "boolean",
nullable: false,
comment: "是否仍可售卖。",
oldClrType: typeof(bool),
oldType: "boolean",
oldComment: "是否仍启用(平台控制)。");
}
}
}

View File

@@ -5760,8 +5760,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasComment("法人或公司主体名称。");
b.Property<string>("LogoUrl")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnType("text")
.HasComment("LOGO 图片地址。");
b.Property<string>("Name")
@@ -6248,7 +6247,19 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasComment("是否仍可售卖。");
.HasComment("是否仍启用(平台控制)。");
b.Property<bool>("IsAllowNewTenantPurchase")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasComment("是否允许新租户购买/选择(仅影响新购)。");
b.Property<bool>("IsPublicVisible")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasComment("是否对外可见(展示页/套餐列表可见性)。");
b.Property<int?>("MaxAccountCount")
.HasColumnType("integer")
@@ -6284,6 +6295,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("integer")
.HasComment("套餐分类(试用、标准、旗舰等)。");
b.Property<int>("PublishStatus")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(1)
.HasComment("发布状态0=草稿1=已发布。");
b.Property<int>("SortOrder")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
@@ -6306,6 +6323,8 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.HasIndex("IsActive", "SortOrder");
b.HasIndex("PublishStatus", "IsActive", "IsPublicVisible", "IsAllowNewTenantPurchase", "SortOrder");
b.ToTable("tenant_packages", null, t =>
{
t.HasComment("平台提供的租户套餐定义。");