lijin
2025-11-20 df6224a4e27e0dadc648cc51ff362e2d7e24a034
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
using System;
using Microsoft.EntityFrameworkCore.Migrations;
 
#nullable disable
 
namespace ApiTools.Database.Migrations.Migrations
{
    /// <inheritdoc />
    public partial class UpdateChannelWallet1119 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "ChannelWallet",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ChannelId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OutWalletId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Access = table.Column<int>(type: "int", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Bank = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BankBranch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Identity = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Balance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    SignStatus = table.Column<int>(type: "int", nullable: false),
                    ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FailReason = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Sort = table.Column<int>(type: "int", nullable: false),
                    TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    CreatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreatedChannelId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
                    UpdatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(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<Guid>(type: "uniqueidentifier", nullable: false),
                    WalletId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Type = table.Column<int>(type: "int", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OutCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ConcurrencyLock = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    Amount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Balance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    AfterBalance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    OutOperatorId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OperatorTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    PayerAccount = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PayerName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PayerBank = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PayerBankBranch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OutReceiveId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ReceiveName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ReceiveIdentity = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ReceiveAccount = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ReceiveBank = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ReceiveBankBranch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Purpose = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FailReason = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TransDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    OrderFee = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    EreceiptFileId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EreceiptDownloadUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EreceiptDownloadOssUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EreceiptStatus = table.Column<int>(type: "int", nullable: true),
                    EreceiptErrorMessage = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TransactionStatus = table.Column<int>(type: "int", nullable: false),
                    Sort = table.Column<int>(type: "int", nullable: false),
                    TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    CreatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreatedChannelId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
                    UpdatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(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<Guid>(type: "uniqueidentifier", nullable: false),
                    FreezeNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StopStt = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StopFailReason = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RemoveStopStt = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RemoveStopFailReason = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ThirdVoucher = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FrontLogNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CstInnerFlowNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsBack = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BackRem = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Yhcljg = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SysFlag = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Fee = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TransBsn = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SubmitTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AccountDate = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    HostFlowNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    HostErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProxyPayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProxyPayAcc = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProxyPayBankName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Sort = table.Column<int>(type: "int", nullable: false),
                    TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    CreatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreatedChannelId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
                    UpdatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsDeleted = table.Column<bool>(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");
        }
 
        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ChannelWalletTransactionPingAnPay");
 
            migrationBuilder.DropTable(
                name: "ChannelWalletTransaction");
 
            migrationBuilder.DropTable(
                name: "ChannelWallet");
        }
    }
}