using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb
{
///
public partial class AddSettlementAccountAndWithdrawalRequest : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SettlementAccount",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ChannelID = table.Column(type: "int", nullable: false),
MemberID = table.Column(type: "int", nullable: false),
BankCode = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false),
BankName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false),
AccountNumber = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false),
AccountHolder = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false),
IsVerified = table.Column(type: "bit", nullable: false),
CreatedAt = table.Column(type: "datetime2", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SettlementAccount", x => x.ID);
table.ForeignKey(
name: "FK_SettlementAccount_Channel_ChannelID",
column: x => x.ChannelID,
principalTable: "Channel",
principalColumn: "ID");
table.ForeignKey(
name: "FK_SettlementAccount_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
},
comment: "정산 계좌");
migrationBuilder.CreateTable(
name: "WithdrawalRequest",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ChannelID = table.Column(type: "int", nullable: false),
MemberID = table.Column(type: "int", nullable: false),
RequestedAmount = table.Column(type: "int", nullable: false),
IncomeTax = table.Column(type: "int", nullable: false),
LocalTax = table.Column(type: "int", nullable: false),
WithholdingTax = table.Column(type: "int", nullable: false),
NetAmount = table.Column(type: "int", nullable: false),
Status = table.Column(type: "int", nullable: false),
BankCode = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false),
BankName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false),
AccountNumber = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false),
AccountHolder = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false),
RequestedAt = table.Column(type: "datetime2", nullable: false),
ProcessedAt = table.Column(type: "datetime2", nullable: true),
RejectedReason = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
AdminMemo = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WithdrawalRequest", x => x.ID);
table.ForeignKey(
name: "FK_WithdrawalRequest_Channel_ChannelID",
column: x => x.ChannelID,
principalTable: "Channel",
principalColumn: "ID");
table.ForeignKey(
name: "FK_WithdrawalRequest_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
},
comment: "출금 요청");
migrationBuilder.CreateIndex(
name: "IX_SettlementAccount_ChannelID_MemberID",
table: "SettlementAccount",
columns: new[] { "ChannelID", "MemberID" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SettlementAccount_MemberID",
table: "SettlementAccount",
column: "MemberID");
migrationBuilder.CreateIndex(
name: "IX_WithdrawalRequest_ChannelID",
table: "WithdrawalRequest",
column: "ChannelID");
migrationBuilder.CreateIndex(
name: "IX_WithdrawalRequest_MemberID_RequestedAt",
table: "WithdrawalRequest",
columns: new[] { "MemberID", "RequestedAt" });
migrationBuilder.CreateIndex(
name: "IX_WithdrawalRequest_MemberID_Status",
table: "WithdrawalRequest",
columns: new[] { "MemberID", "Status" });
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SettlementAccount");
migrationBuilder.DropTable(
name: "WithdrawalRequest");
}
}
}