using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb
{
///
public partial class RenameDanalTables : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PaymentCancel");
migrationBuilder.DropTable(
name: "PaymentConfirm");
migrationBuilder.DropTable(
name: "PaymentLog");
migrationBuilder.RenameColumn(
name: "TransactionId",
table: "PaymentOrder",
newName: "TransactionID");
migrationBuilder.RenameColumn(
name: "OrderId",
table: "PaymentOrder",
newName: "OrderID");
migrationBuilder.RenameColumn(
name: "MerchantId",
table: "PaymentOrder",
newName: "MerchantID");
migrationBuilder.RenameIndex(
name: "IX_PaymentOrder_TransactionId",
table: "PaymentOrder",
newName: "IX_PaymentOrder_TransactionID");
migrationBuilder.RenameIndex(
name: "IX_PaymentOrder_OrderId",
table: "PaymentOrder",
newName: "IX_PaymentOrder_OrderID");
migrationBuilder.CreateTable(
name: "DanalCancel",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false),
PaymentOrderID = table.Column(type: "int", nullable: false),
Method = table.Column(type: "int", nullable: false),
TransactionID = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
OrderID = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
Amount = table.Column(type: "int", nullable: false),
MerchantID = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false),
CancelType = table.Column(type: "int", nullable: false),
CancelRequester = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
CancelReason = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true),
ResponseCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
ResponseMessage = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
OriginalTransactionID = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
CancelledAmount = table.Column(type: "int", nullable: true),
TransDate = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
TransTime = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
Balance = table.Column(type: "int", nullable: true),
RemainedAmount = table.Column(type: "int", nullable: true),
ApprovalDateTime = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DanalCancel", x => x.ID);
table.ForeignKey(
name: "FK_DanalCancel_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
table.ForeignKey(
name: "FK_DanalCancel_PaymentOrder_PaymentOrderID",
column: x => x.PaymentOrderID,
principalTable: "PaymentOrder",
principalColumn: "ID");
},
comment: "다날 결제 취소 (요청+응답)");
migrationBuilder.CreateTable(
name: "DanalConfirm",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false),
PaymentOrderID = table.Column(type: "int", nullable: false),
Method = table.Column(type: "int", nullable: false),
TransactionID = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
OrderID = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
Amount = table.Column(type: "int", nullable: false),
MerchantID = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false),
CertificateToken = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
ResponseCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
ResponseMessage = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
OrderName = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
TotalAmount = table.Column(type: "int", nullable: true),
DiscountAmount = table.Column(type: "int", nullable: true),
UserName = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
TransDate = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: true),
TransTime = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
CardCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
CardName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
CardNo = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
InstallmentMonths = table.Column(type: "tinyint", nullable: true),
ApproveNo = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
ApprovalDateTime = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
AuthKey = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
AccountNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
BankCode = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true),
UserId = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
UserEmail = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: true),
BankName = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
ExpireDate = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true),
ExpireTime = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
VirtualAccountNumber = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: true),
UseCashReceipt = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DanalConfirm", x => x.ID);
table.ForeignKey(
name: "FK_DanalConfirm_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
table.ForeignKey(
name: "FK_DanalConfirm_PaymentOrder_PaymentOrderID",
column: x => x.PaymentOrderID,
principalTable: "PaymentOrder",
principalColumn: "ID");
},
comment: "다날 결제 승인 (요청+응답)");
migrationBuilder.CreateTable(
name: "DanalLog",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false),
LogType = table.Column(type: "int", nullable: false),
Code = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false),
Message = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false),
TransactionID = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
OrderID = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExtraData = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DanalLog", x => x.ID);
table.ForeignKey(
name: "FK_DanalLog_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
},
comment: "다날 결제 에러/실패/웹훅 로그");
migrationBuilder.CreateIndex(
name: "IX_DanalCancel_CancelType",
table: "DanalCancel",
column: "CancelType");
migrationBuilder.CreateIndex(
name: "IX_DanalCancel_MemberID",
table: "DanalCancel",
column: "MemberID");
migrationBuilder.CreateIndex(
name: "IX_DanalCancel_Method",
table: "DanalCancel",
column: "Method");
migrationBuilder.CreateIndex(
name: "IX_DanalCancel_OrderID",
table: "DanalCancel",
column: "OrderID");
migrationBuilder.CreateIndex(
name: "IX_DanalCancel_PaymentOrderID",
table: "DanalCancel",
column: "PaymentOrderID");
migrationBuilder.CreateIndex(
name: "IX_DanalCancel_TransactionID",
table: "DanalCancel",
column: "TransactionID");
migrationBuilder.CreateIndex(
name: "IX_DanalConfirm_MemberID",
table: "DanalConfirm",
column: "MemberID");
migrationBuilder.CreateIndex(
name: "IX_DanalConfirm_Method",
table: "DanalConfirm",
column: "Method");
migrationBuilder.CreateIndex(
name: "IX_DanalConfirm_OrderID",
table: "DanalConfirm",
column: "OrderID",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_DanalConfirm_PaymentOrderID",
table: "DanalConfirm",
column: "PaymentOrderID");
migrationBuilder.CreateIndex(
name: "IX_DanalConfirm_TransactionID",
table: "DanalConfirm",
column: "TransactionID",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_DanalLog_Code",
table: "DanalLog",
column: "Code");
migrationBuilder.CreateIndex(
name: "IX_DanalLog_LogType",
table: "DanalLog",
column: "LogType");
migrationBuilder.CreateIndex(
name: "IX_DanalLog_MemberID",
table: "DanalLog",
column: "MemberID");
migrationBuilder.CreateIndex(
name: "IX_DanalLog_OrderID",
table: "DanalLog",
column: "OrderID");
migrationBuilder.CreateIndex(
name: "IX_DanalLog_TransactionID",
table: "DanalLog",
column: "TransactionID");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DanalCancel");
migrationBuilder.DropTable(
name: "DanalConfirm");
migrationBuilder.DropTable(
name: "DanalLog");
migrationBuilder.RenameColumn(
name: "TransactionID",
table: "PaymentOrder",
newName: "TransactionId");
migrationBuilder.RenameColumn(
name: "OrderID",
table: "PaymentOrder",
newName: "OrderId");
migrationBuilder.RenameColumn(
name: "MerchantID",
table: "PaymentOrder",
newName: "MerchantId");
migrationBuilder.RenameIndex(
name: "IX_PaymentOrder_TransactionID",
table: "PaymentOrder",
newName: "IX_PaymentOrder_TransactionId");
migrationBuilder.RenameIndex(
name: "IX_PaymentOrder_OrderID",
table: "PaymentOrder",
newName: "IX_PaymentOrder_OrderId");
migrationBuilder.CreateTable(
name: "PaymentCancel",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false),
PaymentOrderID = table.Column(type: "int", nullable: false),
Amount = table.Column(type: "int", nullable: false),
ApprovalDateTime = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
Balance = table.Column(type: "int", nullable: true),
CancelReason = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true),
CancelRequester = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
CancelType = table.Column(type: "int", nullable: false),
CancelledAmount = table.Column(type: "int", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false),
MerchantId = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false),
Method = table.Column(type: "int", nullable: false),
OrderId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
OriginalTransactionId = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
RemainedAmount = table.Column(type: "int", nullable: true),
ResponseCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
ResponseMessage = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
TransDate = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
TransTime = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
TransactionId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PaymentCancel", x => x.ID);
table.ForeignKey(
name: "FK_PaymentCancel_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
table.ForeignKey(
name: "FK_PaymentCancel_PaymentOrder_PaymentOrderID",
column: x => x.PaymentOrderID,
principalTable: "PaymentOrder",
principalColumn: "ID");
},
comment: "PG 결제 취소 (요청+응답)");
migrationBuilder.CreateTable(
name: "PaymentConfirm",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false),
PaymentOrderID = table.Column(type: "int", nullable: false),
AccountNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
Amount = table.Column(type: "int", nullable: false),
ApprovalDateTime = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
ApproveNo = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
AuthKey = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
BankCode = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true),
BankName = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
CardCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
CardName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
CardNo = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
CertificateToken = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false),
DiscountAmount = table.Column(type: "int", nullable: true),
ExpireDate = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true),
ExpireTime = table.Column(type: "nvarchar(15)", maxLength: 15, nullable: true),
InstallmentMonths = table.Column(type: "tinyint", nullable: true),
MerchantId = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false),
Method = table.Column(type: "int", nullable: false),
OrderId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
OrderName = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
ResponseCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
ResponseMessage = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
TotalAmount = table.Column(type: "int", nullable: true),
TransDate = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: true),
TransTime = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
TransactionId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
UseCashReceipt = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true),
UserEmail = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: true),
UserId = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
UserName = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true),
VirtualAccountNumber = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PaymentConfirm", x => x.ID);
table.ForeignKey(
name: "FK_PaymentConfirm_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
table.ForeignKey(
name: "FK_PaymentConfirm_PaymentOrder_PaymentOrderID",
column: x => x.PaymentOrderID,
principalTable: "PaymentOrder",
principalColumn: "ID");
},
comment: "PG 결제 승인 (요청+응답)");
migrationBuilder.CreateTable(
name: "PaymentLog",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false),
Code = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false),
CreatedAt = table.Column(type: "datetime2", nullable: false),
ExtraData = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true),
LogType = table.Column(type: "int", nullable: false),
Message = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false),
OrderId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
TransactionId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PaymentLog", x => x.ID);
table.ForeignKey(
name: "FK_PaymentLog_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
},
comment: "PG 결제 에러/실패/웹훅 로그");
migrationBuilder.CreateIndex(
name: "IX_PaymentCancel_CancelType",
table: "PaymentCancel",
column: "CancelType");
migrationBuilder.CreateIndex(
name: "IX_PaymentCancel_MemberID",
table: "PaymentCancel",
column: "MemberID");
migrationBuilder.CreateIndex(
name: "IX_PaymentCancel_Method",
table: "PaymentCancel",
column: "Method");
migrationBuilder.CreateIndex(
name: "IX_PaymentCancel_OrderId",
table: "PaymentCancel",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_PaymentCancel_PaymentOrderID",
table: "PaymentCancel",
column: "PaymentOrderID");
migrationBuilder.CreateIndex(
name: "IX_PaymentCancel_TransactionId",
table: "PaymentCancel",
column: "TransactionId");
migrationBuilder.CreateIndex(
name: "IX_PaymentConfirm_MemberID",
table: "PaymentConfirm",
column: "MemberID");
migrationBuilder.CreateIndex(
name: "IX_PaymentConfirm_Method",
table: "PaymentConfirm",
column: "Method");
migrationBuilder.CreateIndex(
name: "IX_PaymentConfirm_OrderId",
table: "PaymentConfirm",
column: "OrderId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_PaymentConfirm_PaymentOrderID",
table: "PaymentConfirm",
column: "PaymentOrderID");
migrationBuilder.CreateIndex(
name: "IX_PaymentConfirm_TransactionId",
table: "PaymentConfirm",
column: "TransactionId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_PaymentLog_Code",
table: "PaymentLog",
column: "Code");
migrationBuilder.CreateIndex(
name: "IX_PaymentLog_LogType",
table: "PaymentLog",
column: "LogType");
migrationBuilder.CreateIndex(
name: "IX_PaymentLog_MemberID",
table: "PaymentLog",
column: "MemberID");
migrationBuilder.CreateIndex(
name: "IX_PaymentLog_OrderId",
table: "PaymentLog",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_PaymentLog_TransactionId",
table: "PaymentLog",
column: "TransactionId");
}
}
}