245 lines
8.1 KiB
C#
245 lines
8.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace TakeoutSaaS.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddMerchantManagement : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "OperatingMode",
|
|
table: "tenants",
|
|
type: "integer",
|
|
nullable: true,
|
|
comment: "经营模式(同一主体/不同主体)。");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "BusinessLicenseImageUrl",
|
|
table: "stores",
|
|
type: "character varying(500)",
|
|
maxLength: 500,
|
|
nullable: true,
|
|
comment: "门店营业执照图片地址(主体不一致模式使用)。");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "BusinessLicenseNumber",
|
|
table: "stores",
|
|
type: "character varying(50)",
|
|
maxLength: 50,
|
|
nullable: true,
|
|
comment: "门店营业执照号(主体不一致模式使用)。");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "LegalRepresentative",
|
|
table: "stores",
|
|
type: "character varying(100)",
|
|
maxLength: 100,
|
|
nullable: true,
|
|
comment: "门店法人(主体不一致模式使用)。");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "RegisteredAddress",
|
|
table: "stores",
|
|
type: "character varying(500)",
|
|
maxLength: 500,
|
|
nullable: true,
|
|
comment: "门店注册地址(主体不一致模式使用)。");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ApprovedAt",
|
|
table: "merchants",
|
|
type: "timestamp with time zone",
|
|
nullable: true,
|
|
comment: "审核通过时间。");
|
|
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "ApprovedBy",
|
|
table: "merchants",
|
|
type: "bigint",
|
|
nullable: true,
|
|
comment: "审核通过人。");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ClaimExpiresAt",
|
|
table: "merchants",
|
|
type: "timestamp with time zone",
|
|
nullable: true,
|
|
comment: "领取过期时间。");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ClaimedAt",
|
|
table: "merchants",
|
|
type: "timestamp with time zone",
|
|
nullable: true,
|
|
comment: "领取时间。");
|
|
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "ClaimedBy",
|
|
table: "merchants",
|
|
type: "bigint",
|
|
nullable: true,
|
|
comment: "当前领取人。");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ClaimedByName",
|
|
table: "merchants",
|
|
type: "character varying(100)",
|
|
maxLength: 100,
|
|
nullable: true,
|
|
comment: "当前领取人姓名。");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "FrozenAt",
|
|
table: "merchants",
|
|
type: "timestamp with time zone",
|
|
nullable: true,
|
|
comment: "冻结时间。");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "FrozenReason",
|
|
table: "merchants",
|
|
type: "character varying(500)",
|
|
maxLength: 500,
|
|
nullable: true,
|
|
comment: "冻结原因。");
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsFrozen",
|
|
table: "merchants",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false,
|
|
comment: "是否冻结业务。");
|
|
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "LastReviewedBy",
|
|
table: "merchants",
|
|
type: "bigint",
|
|
nullable: true,
|
|
comment: "最近一次审核人。");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "OperatingMode",
|
|
table: "merchants",
|
|
type: "integer",
|
|
nullable: true,
|
|
comment: "经营模式(同一主体/不同主体)。");
|
|
|
|
migrationBuilder.AddColumn<byte[]>(
|
|
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" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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");
|
|
}
|
|
}
|
|
}
|