using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace FlexJobApi.Database.Migrations.Migrations { /// public partial class UpdateUserWalletTransaction0909002 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "UserWallet", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), UserId = table.Column(type: "uniqueidentifier", nullable: false), Balance = table.Column(type: "decimal(18,2)", 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), CreatedEnterpriseId = 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_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(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), Title = table.Column(type: "nvarchar(max)", nullable: true), Amount = table.Column(type: "decimal(18,2)", nullable: false), ActualAmount = table.Column(type: "decimal(18,2)", nullable: false), ServiceFee = 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), TaskUserId = table.Column(type: "uniqueidentifier", nullable: true), EnterpriseName = table.Column(type: "nvarchar(max)", nullable: true), SettlementTime = table.Column(type: "datetime2", nullable: true), SettlementAmount = table.Column(type: "decimal(18,2)", nullable: true), OperatorUserId = table.Column(type: "uniqueidentifier", nullable: true), OperatorTime = table.Column(type: "datetime2", nullable: true), ReceiveName = table.Column(type: "nvarchar(max)", nullable: true), ReceiveAccount = table.Column(type: "nvarchar(max)", nullable: true), Remark = table.Column(type: "nvarchar(max)", nullable: true), TransDate = table.Column(type: "datetime2", nullable: true), EnterpriseWalletTransactionId = table.Column(type: "uniqueidentifier", 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), CreatedEnterpriseId = 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_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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UserWalletTransaction"); migrationBuilder.DropTable( name: "UserWallet"); } } }