using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations
{
///
public partial class AddTenantPackagePublishAndVisibility : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn(
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(
name: "IsActive",
table: "tenant_packages",
type: "boolean",
nullable: false,
comment: "是否仍启用(平台控制)。",
oldClrType: typeof(bool),
oldType: "boolean",
oldComment: "是否仍可售卖。");
migrationBuilder.AddColumn(
name: "IsAllowNewTenantPurchase",
table: "tenant_packages",
type: "boolean",
nullable: false,
defaultValue: true,
comment: "是否允许新租户购买/选择(仅影响新购)。");
migrationBuilder.AddColumn(
name: "IsPublicVisible",
table: "tenant_packages",
type: "boolean",
nullable: false,
defaultValue: true,
comment: "是否对外可见(展示页/套餐列表可见性)。");
migrationBuilder.AddColumn(
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" });
}
///
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(
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(
name: "IsActive",
table: "tenant_packages",
type: "boolean",
nullable: false,
comment: "是否仍可售卖。",
oldClrType: typeof(bool),
oldType: "boolean",
oldComment: "是否仍启用(平台控制)。");
}
}
}