20260414190517_AddSettlementAccountAndWithdrawalRequest.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddSettlementAccountAndWithdrawalRequest : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "SettlementAccount",
  14. columns: table => new
  15. {
  16. ID = table.Column<int>(type: "int", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. ChannelID = table.Column<int>(type: "int", nullable: false),
  19. MemberID = table.Column<int>(type: "int", nullable: false),
  20. BankCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
  21. BankName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  22. AccountNumber = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
  23. AccountHolder = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  24. IsVerified = table.Column<bool>(type: "bit", nullable: false),
  25. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  26. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  27. },
  28. constraints: table =>
  29. {
  30. table.PrimaryKey("PK_SettlementAccount", x => x.ID);
  31. table.ForeignKey(
  32. name: "FK_SettlementAccount_Channel_ChannelID",
  33. column: x => x.ChannelID,
  34. principalTable: "Channel",
  35. principalColumn: "ID");
  36. table.ForeignKey(
  37. name: "FK_SettlementAccount_Member_MemberID",
  38. column: x => x.MemberID,
  39. principalTable: "Member",
  40. principalColumn: "ID");
  41. },
  42. comment: "정산 계좌");
  43. migrationBuilder.CreateTable(
  44. name: "WithdrawalRequest",
  45. columns: table => new
  46. {
  47. ID = table.Column<int>(type: "int", nullable: false)
  48. .Annotation("SqlServer:Identity", "1, 1"),
  49. ChannelID = table.Column<int>(type: "int", nullable: false),
  50. MemberID = table.Column<int>(type: "int", nullable: false),
  51. RequestedAmount = table.Column<int>(type: "int", nullable: false),
  52. IncomeTax = table.Column<int>(type: "int", nullable: false),
  53. LocalTax = table.Column<int>(type: "int", nullable: false),
  54. WithholdingTax = table.Column<int>(type: "int", nullable: false),
  55. NetAmount = table.Column<int>(type: "int", nullable: false),
  56. Status = table.Column<int>(type: "int", nullable: false),
  57. BankCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
  58. BankName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  59. AccountNumber = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
  60. AccountHolder = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  61. RequestedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  62. ProcessedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  63. RejectedReason = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  64. AdminMemo = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true)
  65. },
  66. constraints: table =>
  67. {
  68. table.PrimaryKey("PK_WithdrawalRequest", x => x.ID);
  69. table.ForeignKey(
  70. name: "FK_WithdrawalRequest_Channel_ChannelID",
  71. column: x => x.ChannelID,
  72. principalTable: "Channel",
  73. principalColumn: "ID");
  74. table.ForeignKey(
  75. name: "FK_WithdrawalRequest_Member_MemberID",
  76. column: x => x.MemberID,
  77. principalTable: "Member",
  78. principalColumn: "ID");
  79. },
  80. comment: "출금 요청");
  81. migrationBuilder.CreateIndex(
  82. name: "IX_SettlementAccount_ChannelID_MemberID",
  83. table: "SettlementAccount",
  84. columns: new[] { "ChannelID", "MemberID" },
  85. unique: true);
  86. migrationBuilder.CreateIndex(
  87. name: "IX_SettlementAccount_MemberID",
  88. table: "SettlementAccount",
  89. column: "MemberID");
  90. migrationBuilder.CreateIndex(
  91. name: "IX_WithdrawalRequest_ChannelID",
  92. table: "WithdrawalRequest",
  93. column: "ChannelID");
  94. migrationBuilder.CreateIndex(
  95. name: "IX_WithdrawalRequest_MemberID_RequestedAt",
  96. table: "WithdrawalRequest",
  97. columns: new[] { "MemberID", "RequestedAt" });
  98. migrationBuilder.CreateIndex(
  99. name: "IX_WithdrawalRequest_MemberID_Status",
  100. table: "WithdrawalRequest",
  101. columns: new[] { "MemberID", "Status" });
  102. }
  103. /// <inheritdoc />
  104. protected override void Down(MigrationBuilder migrationBuilder)
  105. {
  106. migrationBuilder.DropTable(
  107. name: "SettlementAccount");
  108. migrationBuilder.DropTable(
  109. name: "WithdrawalRequest");
  110. }
  111. }
  112. }