using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ApiTools.Database.Migrations.Migrations
{
///
public partial class UpdateChannelWallet1119 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ChannelWallet",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
ChannelId = table.Column(type: "uniqueidentifier", nullable: true),
OutWalletId = table.Column(type: "nvarchar(max)", nullable: true),
Access = table.Column(type: "int", nullable: false),
Code = table.Column(type: "nvarchar(max)", nullable: true),
Bank = table.Column(type: "nvarchar(max)", nullable: true),
BankBranch = table.Column(type: "nvarchar(max)", nullable: true),
Name = table.Column(type: "nvarchar(max)", nullable: true),
Identity = table.Column(type: "nvarchar(max)", nullable: true),
Balance = table.Column(type: "decimal(18,2)", nullable: false),
SignStatus = table.Column(type: "int", nullable: false),
ErrorCode = table.Column(type: "nvarchar(max)", nullable: true),
FailReason = table.Column(type: "nvarchar(max)", nullable: true),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChannelWallet", x => x.Id);
table.ForeignKey(
name: "FK_ChannelWallet_Channel_ChannelId",
column: x => x.ChannelId,
principalTable: "Channel",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ChannelWalletTransaction",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
WalletId = table.Column(type: "uniqueidentifier", nullable: false),
Type = table.Column(type: "int", nullable: false),
Code = table.Column(type: "nvarchar(max)", nullable: true),
OutCode = table.Column(type: "nvarchar(max)", nullable: true),
ConcurrencyLock = table.Column(type: "nvarchar(450)", nullable: true),
Amount = table.Column(type: "decimal(18,2)", nullable: false),
Balance = table.Column(type: "decimal(18,2)", nullable: false),
AfterBalance = table.Column(type: "decimal(18,2)", nullable: false),
OutOperatorId = table.Column(type: "nvarchar(max)", nullable: true),
OperatorTime = table.Column(type: "datetime2", nullable: true),
PayerAccount = table.Column(type: "nvarchar(max)", nullable: true),
PayerName = table.Column(type: "nvarchar(max)", nullable: true),
PayerBank = table.Column(type: "nvarchar(max)", nullable: true),
PayerBankBranch = table.Column(type: "nvarchar(max)", nullable: true),
OutReceiveId = table.Column(type: "nvarchar(max)", nullable: true),
ReceiveName = table.Column(type: "nvarchar(max)", nullable: true),
ReceiveIdentity = table.Column(type: "nvarchar(max)", nullable: true),
ReceiveAccount = table.Column(type: "nvarchar(max)", nullable: true),
ReceiveBank = table.Column(type: "nvarchar(max)", nullable: true),
ReceiveBankBranch = table.Column(type: "nvarchar(max)", nullable: true),
Currency = table.Column(type: "nvarchar(max)", nullable: true),
Purpose = table.Column(type: "nvarchar(max)", nullable: true),
Remark = table.Column(type: "nvarchar(max)", nullable: true),
ErrorCode = table.Column(type: "nvarchar(max)", nullable: true),
FailReason = table.Column(type: "nvarchar(max)", nullable: true),
TransDate = table.Column(type: "datetime2", nullable: true),
OrderFee = table.Column(type: "decimal(18,2)", nullable: true),
EreceiptFileId = table.Column(type: "nvarchar(max)", nullable: true),
EreceiptDownloadUrl = table.Column(type: "nvarchar(max)", nullable: true),
EreceiptDownloadOssUrl = table.Column(type: "nvarchar(max)", nullable: true),
EreceiptStatus = table.Column(type: "int", nullable: true),
EreceiptErrorMessage = table.Column(type: "nvarchar(max)", nullable: true),
TransactionStatus = table.Column(type: "int", nullable: false),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChannelWalletTransaction", x => x.Id);
table.ForeignKey(
name: "FK_ChannelWalletTransaction_ChannelWallet_WalletId",
column: x => x.WalletId,
principalTable: "ChannelWallet",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ChannelWalletTransactionPingAnPay",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
FreezeNo = table.Column(type: "nvarchar(max)", nullable: true),
StopStt = table.Column(type: "nvarchar(max)", nullable: true),
StopFailReason = table.Column(type: "nvarchar(max)", nullable: true),
RemoveStopStt = table.Column(type: "nvarchar(max)", nullable: true),
RemoveStopFailReason = table.Column(type: "nvarchar(max)", nullable: true),
ThirdVoucher = table.Column(type: "nvarchar(max)", nullable: true),
FrontLogNo = table.Column(type: "nvarchar(max)", nullable: true),
CstInnerFlowNo = table.Column(type: "nvarchar(max)", nullable: true),
IsBack = table.Column(type: "nvarchar(max)", nullable: true),
BackRem = table.Column(type: "nvarchar(max)", nullable: true),
Yhcljg = table.Column(type: "nvarchar(max)", nullable: true),
SysFlag = table.Column(type: "nvarchar(max)", nullable: true),
Fee = table.Column(type: "nvarchar(max)", nullable: true),
TransBsn = table.Column(type: "nvarchar(max)", nullable: true),
SubmitTime = table.Column(type: "nvarchar(max)", nullable: true),
AccountDate = table.Column(type: "nvarchar(max)", nullable: true),
HostFlowNo = table.Column(type: "nvarchar(max)", nullable: true),
HostErrorCode = table.Column(type: "nvarchar(max)", nullable: true),
ProxyPayName = table.Column(type: "nvarchar(max)", nullable: true),
ProxyPayAcc = table.Column(type: "nvarchar(max)", nullable: true),
ProxyPayBankName = table.Column(type: "nvarchar(max)", nullable: true),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChannelWalletTransactionPingAnPay", x => x.Id);
table.ForeignKey(
name: "FK_ChannelWalletTransactionPingAnPay_ChannelWalletTransaction_Id",
column: x => x.Id,
principalTable: "ChannelWalletTransaction",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ChannelWallet_ChannelId",
table: "ChannelWallet",
column: "ChannelId");
migrationBuilder.CreateIndex(
name: "IX_ChannelWalletTransaction_ConcurrencyLock",
table: "ChannelWalletTransaction",
column: "ConcurrencyLock",
unique: true,
filter: "[ConcurrencyLock] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_ChannelWalletTransaction_WalletId",
table: "ChannelWalletTransaction",
column: "WalletId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ChannelWalletTransactionPingAnPay");
migrationBuilder.DropTable(
name: "ChannelWalletTransaction");
migrationBuilder.DropTable(
name: "ChannelWallet");
}
}
}