using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace TakeoutSaaS.Infrastructure.Migrations { /// public partial class AddMerchantManagement : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "OperatingMode", table: "tenants", type: "integer", nullable: true, comment: "经营模式(同一主体/不同主体)。"); migrationBuilder.AddColumn( name: "BusinessLicenseImageUrl", table: "stores", type: "character varying(500)", maxLength: 500, nullable: true, comment: "门店营业执照图片地址(主体不一致模式使用)。"); migrationBuilder.AddColumn( name: "BusinessLicenseNumber", table: "stores", type: "character varying(50)", maxLength: 50, nullable: true, comment: "门店营业执照号(主体不一致模式使用)。"); migrationBuilder.AddColumn( name: "LegalRepresentative", table: "stores", type: "character varying(100)", maxLength: 100, nullable: true, comment: "门店法人(主体不一致模式使用)。"); migrationBuilder.AddColumn( name: "RegisteredAddress", table: "stores", type: "character varying(500)", maxLength: 500, nullable: true, comment: "门店注册地址(主体不一致模式使用)。"); migrationBuilder.AddColumn( name: "ApprovedAt", table: "merchants", type: "timestamp with time zone", nullable: true, comment: "审核通过时间。"); migrationBuilder.AddColumn( name: "ApprovedBy", table: "merchants", type: "bigint", nullable: true, comment: "审核通过人。"); migrationBuilder.AddColumn( name: "ClaimExpiresAt", table: "merchants", type: "timestamp with time zone", nullable: true, comment: "领取过期时间。"); migrationBuilder.AddColumn( name: "ClaimedAt", table: "merchants", type: "timestamp with time zone", nullable: true, comment: "领取时间。"); migrationBuilder.AddColumn( name: "ClaimedBy", table: "merchants", type: "bigint", nullable: true, comment: "当前领取人。"); migrationBuilder.AddColumn( name: "ClaimedByName", table: "merchants", type: "character varying(100)", maxLength: 100, nullable: true, comment: "当前领取人姓名。"); migrationBuilder.AddColumn( name: "FrozenAt", table: "merchants", type: "timestamp with time zone", nullable: true, comment: "冻结时间。"); migrationBuilder.AddColumn( name: "FrozenReason", table: "merchants", type: "character varying(500)", maxLength: 500, nullable: true, comment: "冻结原因。"); migrationBuilder.AddColumn( name: "IsFrozen", table: "merchants", type: "boolean", nullable: false, defaultValue: false, comment: "是否冻结业务。"); migrationBuilder.AddColumn( name: "LastReviewedBy", table: "merchants", type: "bigint", nullable: true, comment: "最近一次审核人。"); migrationBuilder.AddColumn( name: "OperatingMode", table: "merchants", type: "integer", nullable: true, comment: "经营模式(同一主体/不同主体)。"); migrationBuilder.AddColumn( name: "RowVersion", table: "merchants", type: "bytea", rowVersion: true, nullable: false, defaultValue: new byte[0], comment: "并发控制版本。"); migrationBuilder.CreateIndex( name: "IX_stores_MerchantId_BusinessLicenseNumber", table: "stores", columns: new[] { "MerchantId", "BusinessLicenseNumber" }, unique: true, filter: "\"BusinessLicenseNumber\" IS NOT NULL AND \"Status\" <> 3"); migrationBuilder.CreateIndex( name: "IX_merchants_ClaimedBy", table: "merchants", column: "ClaimedBy"); migrationBuilder.CreateIndex( name: "IX_merchants_TenantId_Status", table: "merchants", columns: new[] { "TenantId", "Status" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_stores_MerchantId_BusinessLicenseNumber", table: "stores"); migrationBuilder.DropIndex( name: "IX_merchants_ClaimedBy", table: "merchants"); migrationBuilder.DropIndex( name: "IX_merchants_TenantId_Status", table: "merchants"); migrationBuilder.DropColumn( name: "OperatingMode", table: "tenants"); migrationBuilder.DropColumn( name: "BusinessLicenseImageUrl", table: "stores"); migrationBuilder.DropColumn( name: "BusinessLicenseNumber", table: "stores"); migrationBuilder.DropColumn( name: "LegalRepresentative", table: "stores"); migrationBuilder.DropColumn( name: "RegisteredAddress", table: "stores"); migrationBuilder.DropColumn( name: "ApprovedAt", table: "merchants"); migrationBuilder.DropColumn( name: "ApprovedBy", table: "merchants"); migrationBuilder.DropColumn( name: "ClaimExpiresAt", table: "merchants"); migrationBuilder.DropColumn( name: "ClaimedAt", table: "merchants"); migrationBuilder.DropColumn( name: "ClaimedBy", table: "merchants"); migrationBuilder.DropColumn( name: "ClaimedByName", table: "merchants"); migrationBuilder.DropColumn( name: "FrozenAt", table: "merchants"); migrationBuilder.DropColumn( name: "FrozenReason", table: "merchants"); migrationBuilder.DropColumn( name: "IsFrozen", table: "merchants"); migrationBuilder.DropColumn( name: "LastReviewedBy", table: "merchants"); migrationBuilder.DropColumn( name: "OperatingMode", table: "merchants"); migrationBuilder.DropColumn( name: "RowVersion", table: "merchants"); } } }