using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace TakeoutSaaS.Infrastructure.Migrations { /// public partial class AddTenantVerificationProfile : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "StoreId", table: "queue_tickets", type: "bigint", nullable: false, comment: "获取或设置所属门店 ID。", oldClrType: typeof(long), oldType: "bigint"); migrationBuilder.AddColumn( name: "BatchConsumeStrategy", table: "inventory_items", type: "integer", nullable: false, defaultValue: 0, comment: "批次扣减策略。"); migrationBuilder.AddColumn( name: "IsPresale", table: "inventory_items", type: "boolean", nullable: false, defaultValue: false, comment: "是否预售商品。"); migrationBuilder.AddColumn( name: "IsSoldOut", table: "inventory_items", type: "boolean", nullable: false, defaultValue: false, comment: "是否标记售罄。"); migrationBuilder.AddColumn( name: "MaxQuantityPerOrder", table: "inventory_items", type: "integer", nullable: true, comment: "单品限购(覆盖商品级 MaxQuantityPerOrder)。"); migrationBuilder.AddColumn( name: "PresaleCapacity", table: "inventory_items", type: "integer", nullable: true, comment: "预售名额(上限)。"); migrationBuilder.AddColumn( name: "PresaleEndTime", table: "inventory_items", type: "timestamp with time zone", nullable: true, comment: "预售结束时间(UTC)。"); migrationBuilder.AddColumn( name: "PresaleLocked", table: "inventory_items", type: "integer", nullable: false, defaultValue: 0, comment: "当前预售已锁定数量。"); migrationBuilder.AddColumn( name: "PresaleStartTime", table: "inventory_items", type: "timestamp with time zone", nullable: true, comment: "预售开始时间(UTC)。"); migrationBuilder.AddColumn( name: "RowVersion", table: "inventory_items", type: "bytea", rowVersion: true, nullable: false, defaultValue: new byte[0], comment: "并发控制字段。"); migrationBuilder.AddColumn( name: "RowVersion", table: "inventory_batches", type: "bytea", rowVersion: true, nullable: false, defaultValue: new byte[0], comment: "并发控制字段。"); migrationBuilder.AlterColumn( name: "OrderId", table: "delivery_orders", type: "bigint", nullable: false, comment: "获取或设置关联订单 ID。", oldClrType: typeof(long), oldType: "bigint"); migrationBuilder.CreateTable( name: "inventory_lock_records", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), StoreId = table.Column(type: "bigint", nullable: false, comment: "门店 ID。"), ProductSkuId = table.Column(type: "bigint", nullable: false, comment: "SKU ID。"), Quantity = table.Column(type: "integer", nullable: false, comment: "锁定数量。"), IsPresale = table.Column(type: "boolean", nullable: false, comment: "是否预售锁定。"), IdempotencyKey = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "幂等键。"), ExpiresAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "过期时间(UTC)。"), Status = table.Column(type: "integer", nullable: false, comment: "锁定状态。"), RowVersion = table.Column(type: "bytea", rowVersion: true, nullable: false, comment: "并发控制字段。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") }, constraints: table => { table.PrimaryKey("PK_inventory_lock_records", x => x.Id); }, comment: "库存锁定记录。"); migrationBuilder.CreateTable( name: "merchant_audit_logs", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), MerchantId = table.Column(type: "bigint", nullable: false, comment: "商户标识。"), Action = table.Column(type: "integer", nullable: false, comment: "动作类型。"), Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "标题。"), Description = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true, comment: "详情描述。"), OperatorId = table.Column(type: "bigint", nullable: true, comment: "操作人 ID。"), OperatorName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "操作人名称。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") }, constraints: table => { table.PrimaryKey("PK_merchant_audit_logs", x => x.Id); }, comment: "商户入驻审核日志。"); migrationBuilder.CreateTable( name: "merchant_categories", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "类目名称。"), DisplayOrder = table.Column(type: "integer", nullable: false, defaultValue: 0, comment: "显示顺序,越小越靠前。"), IsActive = table.Column(type: "boolean", nullable: false, comment: "是否可用。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") }, constraints: table => { table.PrimaryKey("PK_merchant_categories", x => x.Id); }, comment: "商户可选类目。"); migrationBuilder.CreateTable( name: "store_pickup_settings", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), AllowToday = table.Column(type: "boolean", nullable: false, comment: "是否允许当天自提。"), AllowDaysAhead = table.Column(type: "integer", nullable: false, comment: "可预约天数(含当天)。"), DefaultCutoffMinutes = table.Column(type: "integer", nullable: false, defaultValue: 30, comment: "默认截单分钟(开始前多少分钟截止)。"), MaxQuantityPerOrder = table.Column(type: "integer", nullable: true, comment: "单笔自提最大份数。"), RowVersion = table.Column(type: "bytea", rowVersion: true, nullable: false, comment: "并发控制字段。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") }, constraints: table => { table.PrimaryKey("PK_store_pickup_settings", x => x.Id); }, comment: "门店自提配置。"); migrationBuilder.CreateTable( name: "store_pickup_slots", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), StoreId = table.Column(type: "bigint", nullable: false, comment: "门店标识。"), Name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "档期名称。"), StartTime = table.Column(type: "interval", nullable: false, comment: "当天开始时间(UTC)。"), EndTime = table.Column(type: "interval", nullable: false, comment: "当天结束时间(UTC)。"), CutoffMinutes = table.Column(type: "integer", nullable: false, defaultValue: 30, comment: "截单分钟(开始前多少分钟截止)。"), Capacity = table.Column(type: "integer", nullable: false, comment: "容量(份数)。"), ReservedCount = table.Column(type: "integer", nullable: false, comment: "已占用数量。"), Weekdays = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "适用星期(逗号分隔 1-7)。"), IsEnabled = table.Column(type: "boolean", nullable: false, comment: "是否启用。"), RowVersion = table.Column(type: "bytea", rowVersion: true, nullable: false, comment: "并发控制字段。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") }, constraints: table => { table.PrimaryKey("PK_store_pickup_slots", x => x.Id); }, comment: "门店自提档期。"); migrationBuilder.CreateTable( name: "tenant_announcement_reads", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), AnnouncementId = table.Column(type: "bigint", nullable: false, comment: "公告 ID。"), UserId = table.Column(type: "bigint", nullable: true, comment: "已读用户 ID(后台账号),为空表示租户级已读。"), ReadAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "已读时间。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") }, constraints: table => { table.PrimaryKey("PK_tenant_announcement_reads", x => x.Id); }, comment: "租户公告已读记录。"); migrationBuilder.CreateTable( name: "tenant_announcements", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "公告标题。"), Content = table.Column(type: "text", nullable: false, comment: "公告正文(可为 Markdown/HTML,前端自行渲染)。"), AnnouncementType = table.Column(type: "integer", nullable: false, comment: "公告类型。"), Priority = table.Column(type: "integer", nullable: false, comment: "展示优先级,数值越大越靠前。"), EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: false, comment: "生效时间(UTC)。"), EffectiveTo = table.Column(type: "timestamp with time zone", nullable: true, comment: "失效时间(UTC),为空表示长期有效。"), IsActive = table.Column(type: "boolean", nullable: false, comment: "是否启用。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"), TenantId = table.Column(type: "bigint", nullable: false, comment: "所属租户 ID。") }, constraints: table => { table.PrimaryKey("PK_tenant_announcements", x => x.Id); }, comment: "租户公告。"); migrationBuilder.CreateTable( name: "tenant_audit_logs", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), TenantId = table.Column(type: "bigint", nullable: false, comment: "关联的租户标识。"), Action = table.Column(type: "integer", nullable: false, comment: "操作类型。"), Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "日志标题。"), Description = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true, comment: "详细描述。"), OperatorId = table.Column(type: "bigint", nullable: true, comment: "操作人 ID。"), OperatorName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "操作人名称。"), PreviousStatus = table.Column(type: "integer", nullable: true, comment: "原状态。"), CurrentStatus = table.Column(type: "integer", nullable: true, comment: "新状态。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。") }, constraints: table => { table.PrimaryKey("PK_tenant_audit_logs", x => x.Id); }, comment: "租户运营审核日志。"); migrationBuilder.CreateTable( name: "tenant_subscription_histories", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), TenantId = table.Column(type: "bigint", nullable: false, comment: "租户标识。"), TenantSubscriptionId = table.Column(type: "bigint", nullable: false, comment: "对应的订阅 ID。"), FromPackageId = table.Column(type: "bigint", nullable: false, comment: "原套餐 ID。"), ToPackageId = table.Column(type: "bigint", nullable: false, comment: "新套餐 ID。"), ChangeType = table.Column(type: "integer", nullable: false, comment: "变更类型。"), EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: false, comment: "生效时间。"), EffectiveTo = table.Column(type: "timestamp with time zone", nullable: false, comment: "到期时间。"), Amount = table.Column(type: "numeric", nullable: true, comment: "相关费用。"), Currency = table.Column(type: "character varying(8)", maxLength: 8, nullable: true, comment: "币种。"), Notes = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "备注。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。") }, constraints: table => { table.PrimaryKey("PK_tenant_subscription_histories", x => x.Id); }, comment: "租户套餐订阅变更记录。"); migrationBuilder.CreateTable( name: "tenant_verification_profiles", columns: table => new { Id = table.Column(type: "bigint", nullable: false, comment: "实体唯一标识。") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), TenantId = table.Column(type: "bigint", nullable: false, comment: "对应的租户标识。"), Status = table.Column(type: "integer", nullable: false, comment: "实名状态。"), BusinessLicenseNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "营业执照编号。"), BusinessLicenseUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "营业执照文件地址。"), LegalPersonName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "法人姓名。"), LegalPersonIdNumber = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "法人身份证号。"), LegalPersonIdFrontUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "法人身份证正面。"), LegalPersonIdBackUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "法人身份证反面。"), BankAccountName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "开户名。"), BankAccountNumber = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "银行账号。"), BankName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "银行名称。"), AdditionalDataJson = table.Column(type: "text", nullable: true, comment: "附加资料(JSON)。"), SubmittedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "提交时间。"), ReviewedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "审核时间。"), ReviewedBy = table.Column(type: "bigint", nullable: true, comment: "审核人 ID。"), ReviewedByName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "审核人姓名。"), ReviewRemarks = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "审核备注。"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间(UTC)。"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间(UTC),从未更新时为 null。"), DeletedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "软删除时间(UTC),未删除时为 null。"), CreatedBy = table.Column(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"), UpdatedBy = table.Column(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"), DeletedBy = table.Column(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。") }, constraints: table => { table.PrimaryKey("PK_tenant_verification_profiles", x => x.Id); }, comment: "租户实名认证资料。"); migrationBuilder.CreateIndex( name: "IX_inventory_lock_records_TenantId_IdempotencyKey", table: "inventory_lock_records", columns: new[] { "TenantId", "IdempotencyKey" }, unique: true); migrationBuilder.CreateIndex( name: "IX_inventory_lock_records_TenantId_StoreId_ProductSkuId_Status", table: "inventory_lock_records", columns: new[] { "TenantId", "StoreId", "ProductSkuId", "Status" }); migrationBuilder.CreateIndex( name: "IX_merchant_audit_logs_TenantId_MerchantId", table: "merchant_audit_logs", columns: new[] { "TenantId", "MerchantId" }); migrationBuilder.CreateIndex( name: "IX_merchant_categories_TenantId_Name", table: "merchant_categories", columns: new[] { "TenantId", "Name" }, unique: true); migrationBuilder.CreateIndex( name: "IX_store_pickup_settings_TenantId_StoreId", table: "store_pickup_settings", columns: new[] { "TenantId", "StoreId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_store_pickup_slots_TenantId_StoreId_Name", table: "store_pickup_slots", columns: new[] { "TenantId", "StoreId", "Name" }); migrationBuilder.CreateIndex( name: "IX_tenant_announcement_reads_TenantId_AnnouncementId_UserId", table: "tenant_announcement_reads", columns: new[] { "TenantId", "AnnouncementId", "UserId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_tenant_announcements_TenantId_AnnouncementType_IsActive", table: "tenant_announcements", columns: new[] { "TenantId", "AnnouncementType", "IsActive" }); migrationBuilder.CreateIndex( name: "IX_tenant_announcements_TenantId_EffectiveFrom_EffectiveTo", table: "tenant_announcements", columns: new[] { "TenantId", "EffectiveFrom", "EffectiveTo" }); migrationBuilder.CreateIndex( name: "IX_tenant_audit_logs_TenantId", table: "tenant_audit_logs", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_tenant_subscription_histories_TenantId_TenantSubscriptionId", table: "tenant_subscription_histories", columns: new[] { "TenantId", "TenantSubscriptionId" }); migrationBuilder.CreateIndex( name: "IX_tenant_verification_profiles_TenantId", table: "tenant_verification_profiles", column: "TenantId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "inventory_lock_records"); migrationBuilder.DropTable( name: "merchant_audit_logs"); migrationBuilder.DropTable( name: "merchant_categories"); migrationBuilder.DropTable( name: "store_pickup_settings"); migrationBuilder.DropTable( name: "store_pickup_slots"); migrationBuilder.DropTable( name: "tenant_announcement_reads"); migrationBuilder.DropTable( name: "tenant_announcements"); migrationBuilder.DropTable( name: "tenant_audit_logs"); migrationBuilder.DropTable( name: "tenant_subscription_histories"); migrationBuilder.DropTable( name: "tenant_verification_profiles"); migrationBuilder.DropColumn( name: "BatchConsumeStrategy", table: "inventory_items"); migrationBuilder.DropColumn( name: "IsPresale", table: "inventory_items"); migrationBuilder.DropColumn( name: "IsSoldOut", table: "inventory_items"); migrationBuilder.DropColumn( name: "MaxQuantityPerOrder", table: "inventory_items"); migrationBuilder.DropColumn( name: "PresaleCapacity", table: "inventory_items"); migrationBuilder.DropColumn( name: "PresaleEndTime", table: "inventory_items"); migrationBuilder.DropColumn( name: "PresaleLocked", table: "inventory_items"); migrationBuilder.DropColumn( name: "PresaleStartTime", table: "inventory_items"); migrationBuilder.DropColumn( name: "RowVersion", table: "inventory_items"); migrationBuilder.DropColumn( name: "RowVersion", table: "inventory_batches"); migrationBuilder.AlterColumn( name: "StoreId", table: "queue_tickets", type: "bigint", nullable: false, oldClrType: typeof(long), oldType: "bigint", oldComment: "获取或设置所属门店 ID。"); migrationBuilder.AlterColumn( name: "OrderId", table: "delivery_orders", type: "bigint", nullable: false, oldClrType: typeof(long), oldType: "bigint", oldComment: "获取或设置关联订单 ID。"); } } }