sunpengfei
昨天 f2531a32531f2da6c6119201dc7c7d666e583bf2
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
using System;
using Microsoft.EntityFrameworkCore.Migrations;
 
#nullable disable
 
namespace FlexJobApi.Database.Migrations.Migrations
{
    /// <inheritdoc />
    public partial class UpdateUserWalletTransaction0909002 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "UserWallet",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Balance = table.Column<decimal>(type: "decimal(18,2)", 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),
                    CreatedEnterpriseId = 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_UserWallet", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserWallet_User_UserId",
                        column: x => x.UserId,
                        principalTable: "User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });
 
            migrationBuilder.CreateTable(
                name: "UserWalletTransaction",
                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),
                    Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Amount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ActualAmount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ServiceFee = 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),
                    TaskUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    EnterpriseName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SettlementTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SettlementAmount = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    OperatorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OperatorTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ReceiveName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ReceiveAccount = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TransDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    EnterpriseWalletTransactionId = table.Column<Guid>(type: "uniqueidentifier", 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),
                    CreatedEnterpriseId = 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_UserWalletTransaction", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserWalletTransaction_EnterpriseWalletTransaction_EnterpriseWalletTransactionId",
                        column: x => x.EnterpriseWalletTransactionId,
                        principalTable: "EnterpriseWalletTransaction",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_UserWalletTransaction_TaskInfoUser_TaskUserId",
                        column: x => x.TaskUserId,
                        principalTable: "TaskInfoUser",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_UserWalletTransaction_UserWallet_WalletId",
                        column: x => x.WalletId,
                        principalTable: "UserWallet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_UserWalletTransaction_User_OperatorUserId",
                        column: x => x.OperatorUserId,
                        principalTable: "User",
                        principalColumn: "Id");
                });
 
            migrationBuilder.CreateIndex(
                name: "IX_UserWallet_UserId",
                table: "UserWallet",
                column: "UserId");
 
            migrationBuilder.CreateIndex(
                name: "IX_UserWalletTransaction_EnterpriseWalletTransactionId",
                table: "UserWalletTransaction",
                column: "EnterpriseWalletTransactionId");
 
            migrationBuilder.CreateIndex(
                name: "IX_UserWalletTransaction_OperatorUserId",
                table: "UserWalletTransaction",
                column: "OperatorUserId");
 
            migrationBuilder.CreateIndex(
                name: "IX_UserWalletTransaction_TaskUserId",
                table: "UserWalletTransaction",
                column: "TaskUserId");
 
            migrationBuilder.CreateIndex(
                name: "IX_UserWalletTransaction_WalletId",
                table: "UserWalletTransaction",
                column: "WalletId");
        }
 
        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "UserWalletTransaction");
 
            migrationBuilder.DropTable(
                name: "UserWallet");
        }
    }
}