20260419025127_AddChatExpConfigAndMemberExpLogBroadcastSession.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace Infrastructure.Migrations.AppDb;
  4. /// <inheritdoc />
  5. public partial class AddChatExpConfigAndMemberExpLogBroadcastSession : Migration
  6. {
  7. /// <inheritdoc />
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.AddColumn<int>(
  11. name: "BroadcastSessionID",
  12. table: "MemberExpLog",
  13. type: "int",
  14. nullable: true,
  15. comment: "방송 세션 ID (리더보드 집계 대상)");
  16. migrationBuilder.AddColumn<int>(
  17. name: "ChannelID",
  18. table: "MemberExpLog",
  19. type: "int",
  20. nullable: true,
  21. comment: "채널 ID (channel 단위 조회용)");
  22. migrationBuilder.AddColumn<int>(
  23. name: "ChatExp_ChatXpPerMessage",
  24. table: "Config",
  25. type: "int",
  26. nullable: false,
  27. defaultValue: 1,
  28. comment: "채팅 1건당 지급 XP");
  29. migrationBuilder.AddColumn<int>(
  30. name: "ChatExp_ChatXpSessionLimit",
  31. table: "Config",
  32. type: "int",
  33. nullable: false,
  34. defaultValue: 50,
  35. comment: "방송 세션당 채팅 XP 상한");
  36. migrationBuilder.AddColumn<int>(
  37. name: "ChatExp_CrownTopN",
  38. table: "Config",
  39. type: "int",
  40. nullable: false,
  41. defaultValue: 3,
  42. comment: "크라운 뱃지 Top N");
  43. migrationBuilder.AddColumn<int>(
  44. name: "ChatExp_DonationXpPerAmount",
  45. table: "Config",
  46. type: "int",
  47. nullable: false,
  48. defaultValue: 1000,
  49. comment: "후원 N POINT당 1 XP");
  50. migrationBuilder.AddColumn<int>(
  51. name: "ChatExp_LeaderboardSize",
  52. table: "Config",
  53. type: "int",
  54. nullable: false,
  55. defaultValue: 50,
  56. comment: "리더보드 Top N");
  57. migrationBuilder.AddColumn<int>(
  58. name: "ChatExp_MinContentLength",
  59. table: "Config",
  60. type: "int",
  61. nullable: false,
  62. defaultValue: 2,
  63. comment: "XP 적립 최소 글자수");
  64. migrationBuilder.AddColumn<int>(
  65. name: "ChatExp_RateLimitSec",
  66. table: "Config",
  67. type: "int",
  68. nullable: false,
  69. defaultValue: 2,
  70. comment: "채팅 쿨다운(초)");
  71. migrationBuilder.AddColumn<bool>(
  72. name: "ChatExp_UxShowLeaderboard",
  73. table: "Config",
  74. type: "bit",
  75. nullable: false,
  76. defaultValue: true,
  77. comment: "watch에서 리더보드 노출");
  78. migrationBuilder.AddColumn<bool>(
  79. name: "ChatExp_UxShowMyXpBadge",
  80. table: "Config",
  81. type: "bit",
  82. nullable: false,
  83. defaultValue: true,
  84. comment: "내 XP 뱃지 노출");
  85. migrationBuilder.CreateIndex(
  86. name: "IX_MemberExpLog_BroadcastSessionID_MemberID",
  87. table: "MemberExpLog",
  88. columns: new[] { "BroadcastSessionID", "MemberID" });
  89. migrationBuilder.CreateIndex(
  90. name: "IX_MemberExpLog_ChannelID_MemberID_CreatedAt",
  91. table: "MemberExpLog",
  92. columns: new[] { "ChannelID", "MemberID", "CreatedAt" });
  93. migrationBuilder.AddForeignKey(
  94. name: "FK_MemberExpLog_BroadcastSession_BroadcastSessionID",
  95. table: "MemberExpLog",
  96. column: "BroadcastSessionID",
  97. principalTable: "BroadcastSession",
  98. principalColumn: "ID",
  99. onDelete: ReferentialAction.NoAction);
  100. }
  101. /// <inheritdoc />
  102. protected override void Down(MigrationBuilder migrationBuilder)
  103. {
  104. migrationBuilder.DropForeignKey(
  105. name: "FK_MemberExpLog_BroadcastSession_BroadcastSessionID",
  106. table: "MemberExpLog");
  107. migrationBuilder.DropIndex(
  108. name: "IX_MemberExpLog_BroadcastSessionID_MemberID",
  109. table: "MemberExpLog");
  110. migrationBuilder.DropIndex(
  111. name: "IX_MemberExpLog_ChannelID_MemberID_CreatedAt",
  112. table: "MemberExpLog");
  113. migrationBuilder.DropColumn(
  114. name: "BroadcastSessionID",
  115. table: "MemberExpLog");
  116. migrationBuilder.DropColumn(
  117. name: "ChannelID",
  118. table: "MemberExpLog");
  119. migrationBuilder.DropColumn(
  120. name: "ChatExp_ChatXpPerMessage",
  121. table: "Config");
  122. migrationBuilder.DropColumn(
  123. name: "ChatExp_ChatXpSessionLimit",
  124. table: "Config");
  125. migrationBuilder.DropColumn(
  126. name: "ChatExp_CrownTopN",
  127. table: "Config");
  128. migrationBuilder.DropColumn(
  129. name: "ChatExp_DonationXpPerAmount",
  130. table: "Config");
  131. migrationBuilder.DropColumn(
  132. name: "ChatExp_LeaderboardSize",
  133. table: "Config");
  134. migrationBuilder.DropColumn(
  135. name: "ChatExp_MinContentLength",
  136. table: "Config");
  137. migrationBuilder.DropColumn(
  138. name: "ChatExp_RateLimitSec",
  139. table: "Config");
  140. migrationBuilder.DropColumn(
  141. name: "ChatExp_UxShowLeaderboard",
  142. table: "Config");
  143. migrationBuilder.DropColumn(
  144. name: "ChatExp_UxShowMyXpBadge",
  145. table: "Config");
  146. }
  147. }