20260703000621_RemoveDonationSettlementDeveloperDomains.cs 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class RemoveDonationSettlementDeveloperDomains : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.DropTable(
  13. name: "ApiApplicationScope");
  14. migrationBuilder.DropTable(
  15. name: "ApiCredential");
  16. migrationBuilder.DropTable(
  17. name: "ApiPersonalAccessToken");
  18. migrationBuilder.DropTable(
  19. name: "ApiPurchaseCancel");
  20. migrationBuilder.DropTable(
  21. name: "ApiRateLimit");
  22. migrationBuilder.DropTable(
  23. name: "ApiRequestLog");
  24. migrationBuilder.DropTable(
  25. name: "CrewDonationSummary");
  26. migrationBuilder.DropTable(
  27. name: "CrewInvitation");
  28. migrationBuilder.DropTable(
  29. name: "CrewSessionConsent");
  30. migrationBuilder.DropTable(
  31. name: "CrewWidgetConfig");
  32. migrationBuilder.DropTable(
  33. name: "DonationAlertAttempt");
  34. migrationBuilder.DropTable(
  35. name: "DonationAlertConfig");
  36. migrationBuilder.DropTable(
  37. name: "DonationGoalConfig");
  38. migrationBuilder.DropTable(
  39. name: "DonationMeta");
  40. migrationBuilder.DropTable(
  41. name: "DonationRankConfig");
  42. migrationBuilder.DropTable(
  43. name: "DonationRanking");
  44. migrationBuilder.DropTable(
  45. name: "DonorChannelStats");
  46. migrationBuilder.DropTable(
  47. name: "DonorTitleSelection");
  48. migrationBuilder.DropTable(
  49. name: "GameProductCatalog");
  50. migrationBuilder.DropTable(
  51. name: "NiceAuthSession");
  52. migrationBuilder.DropTable(
  53. name: "RankingSnapshot");
  54. migrationBuilder.DropTable(
  55. name: "Settlement");
  56. migrationBuilder.DropTable(
  57. name: "SettlementAccount");
  58. migrationBuilder.DropTable(
  59. name: "WithdrawalRequest");
  60. migrationBuilder.DropTable(
  61. name: "ApiPurchase");
  62. migrationBuilder.DropTable(
  63. name: "DonationAlert");
  64. migrationBuilder.DropTable(
  65. name: "ChannelTitle");
  66. migrationBuilder.DropTable(
  67. name: "Developer");
  68. migrationBuilder.DropTable(
  69. name: "ApiApplication");
  70. migrationBuilder.DropTable(
  71. name: "Donation");
  72. migrationBuilder.DropTable(
  73. name: "CrewMember");
  74. migrationBuilder.DropTable(
  75. name: "CrewSession");
  76. migrationBuilder.DropTable(
  77. name: "Crew");
  78. migrationBuilder.DropColumn(
  79. name: "ApiCommissionRate",
  80. table: "Game");
  81. migrationBuilder.AlterColumn<int>(
  82. name: "ChannelRewardAmount",
  83. table: "Order",
  84. type: "int",
  85. nullable: false,
  86. comment: "채널주 채널 보상 입금 금액 (비활성 — 과거 주문 호환)",
  87. oldClrType: typeof(int),
  88. oldType: "int",
  89. oldComment: "채널주 StoreRevenue 입금 금액");
  90. }
  91. /// <inheritdoc />
  92. protected override void Down(MigrationBuilder migrationBuilder)
  93. {
  94. migrationBuilder.AlterColumn<int>(
  95. name: "ChannelRewardAmount",
  96. table: "Order",
  97. type: "int",
  98. nullable: false,
  99. comment: "채널주 StoreRevenue 입금 금액",
  100. oldClrType: typeof(int),
  101. oldType: "int",
  102. oldComment: "채널주 채널 보상 입금 금액 (비활성 — 과거 주문 호환)");
  103. migrationBuilder.AddColumn<decimal>(
  104. name: "ApiCommissionRate",
  105. table: "Game",
  106. type: "decimal(10,7)",
  107. precision: 10,
  108. scale: 7,
  109. nullable: false,
  110. defaultValue: 0m,
  111. comment: "API 결제 보고 채널 수수료율(%) — 0~100, 0=비대상");
  112. migrationBuilder.CreateTable(
  113. name: "ApiApplication",
  114. columns: table => new
  115. {
  116. ID = table.Column<int>(type: "int", nullable: false)
  117. .Annotation("SqlServer:Identity", "1, 1"),
  118. OwnerMemberID = table.Column<int>(type: "int", nullable: false),
  119. ApprovedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  120. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  121. Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  122. HomepageUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  123. LogoPath = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  124. Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  125. Status = table.Column<int>(type: "int", nullable: false),
  126. SuspendedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  127. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  128. },
  129. constraints: table =>
  130. {
  131. table.PrimaryKey("PK_ApiApplication", x => x.ID);
  132. table.ForeignKey(
  133. name: "FK_ApiApplication_Member_OwnerMemberID",
  134. column: x => x.OwnerMemberID,
  135. principalTable: "Member",
  136. principalColumn: "ID",
  137. onDelete: ReferentialAction.Cascade);
  138. },
  139. comment: "개발자 API 앱");
  140. migrationBuilder.CreateTable(
  141. name: "ApiPersonalAccessToken",
  142. columns: table => new
  143. {
  144. ID = table.Column<long>(type: "bigint", nullable: false)
  145. .Annotation("SqlServer:Identity", "1, 1"),
  146. OwnerMemberID = table.Column<int>(type: "int", nullable: false),
  147. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  148. ExpiresAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  149. LastUsedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  150. Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  151. RevokedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  152. ScopesCsv = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: false),
  153. TokenHash = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  154. TokenHint = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false)
  155. },
  156. constraints: table =>
  157. {
  158. table.PrimaryKey("PK_ApiPersonalAccessToken", x => x.ID);
  159. table.ForeignKey(
  160. name: "FK_ApiPersonalAccessToken_Member_OwnerMemberID",
  161. column: x => x.OwnerMemberID,
  162. principalTable: "Member",
  163. principalColumn: "ID",
  164. onDelete: ReferentialAction.Cascade);
  165. },
  166. comment: "Personal Access Token (PAT)");
  167. migrationBuilder.CreateTable(
  168. name: "ApiRequestLog",
  169. columns: table => new
  170. {
  171. ID = table.Column<long>(type: "bigint", nullable: false)
  172. .Annotation("SqlServer:Identity", "1, 1"),
  173. ApplicationID = table.Column<int>(type: "int", nullable: true),
  174. Endpoint = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
  175. IpAddress = table.Column<string>(type: "nvarchar(45)", maxLength: 45, nullable: true),
  176. Method = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
  177. PatID = table.Column<long>(type: "bigint", nullable: true),
  178. RequestedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  179. ResponseMs = table.Column<int>(type: "int", nullable: false),
  180. StatusCode = table.Column<int>(type: "int", nullable: false)
  181. },
  182. constraints: table =>
  183. {
  184. table.PrimaryKey("PK_ApiRequestLog", x => x.ID);
  185. },
  186. comment: "공개 API 호출 로그");
  187. migrationBuilder.CreateTable(
  188. name: "ChannelTitle",
  189. columns: table => new
  190. {
  191. ID = table.Column<int>(type: "int", nullable: false)
  192. .Annotation("SqlServer:Identity", "1, 1"),
  193. ChannelID = table.Column<int>(type: "int", nullable: false, comment: "채널 ID"),
  194. Color = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "칭호 색상 (hex)"),
  195. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "생성 일시"),
  196. Description = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "칭호 설명"),
  197. IconUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true, comment: "칭호 아이콘 URL"),
  198. IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "활성 여부"),
  199. MinAmount = table.Column<long>(type: "bigint", nullable: false, comment: "획득 조건 (누적 후원 최소 금액)"),
  200. Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "칭호 이름"),
  201. SortOrder = table.Column<int>(type: "int", nullable: false, comment: "정렬 순서"),
  202. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시")
  203. },
  204. constraints: table =>
  205. {
  206. table.PrimaryKey("PK_ChannelTitle", x => x.ID);
  207. table.ForeignKey(
  208. name: "FK_ChannelTitle_Channel_ChannelID",
  209. column: x => x.ChannelID,
  210. principalTable: "Channel",
  211. principalColumn: "ID",
  212. onDelete: ReferentialAction.Cascade);
  213. },
  214. comment: "채널별 칭호 (크리에이터 설정)");
  215. migrationBuilder.CreateTable(
  216. name: "Crew",
  217. columns: table => new
  218. {
  219. ID = table.Column<int>(type: "int", nullable: false)
  220. .Annotation("SqlServer:Identity", "1, 1"),
  221. ChannelID = table.Column<int>(type: "int", nullable: false),
  222. MemberID = table.Column<int>(type: "int", nullable: false),
  223. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  224. Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  225. InviteCode = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: true),
  226. IsActive = table.Column<bool>(type: "bit", nullable: false),
  227. MinAmount = table.Column<int>(type: "int", nullable: true),
  228. Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  229. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  230. },
  231. constraints: table =>
  232. {
  233. table.PrimaryKey("PK_Crew", x => x.ID);
  234. table.ForeignKey(
  235. name: "FK_Crew_Channel_ChannelID",
  236. column: x => x.ChannelID,
  237. principalTable: "Channel",
  238. principalColumn: "ID",
  239. onDelete: ReferentialAction.Cascade);
  240. table.ForeignKey(
  241. name: "FK_Crew_Member_MemberID",
  242. column: x => x.MemberID,
  243. principalTable: "Member",
  244. principalColumn: "ID");
  245. },
  246. comment: "크루");
  247. migrationBuilder.CreateTable(
  248. name: "Developer",
  249. columns: table => new
  250. {
  251. ID = table.Column<int>(type: "int", nullable: false)
  252. .Annotation("SqlServer:Identity", "1, 1"),
  253. MemberID = table.Column<int>(type: "int", nullable: false),
  254. ApprovalReason = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  255. ApprovalStatus = table.Column<int>(type: "int", nullable: false),
  256. ApprovedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  257. ApprovedByAdminID = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  258. BusinessNumber = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
  259. CeoName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  260. CompanyName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
  261. ContactName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  262. ContactPhone = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
  263. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  264. KycCi = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  265. KycDi = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  266. KycStatus = table.Column<int>(type: "int", nullable: false),
  267. KycVerifiedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  268. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  269. },
  270. constraints: table =>
  271. {
  272. table.PrimaryKey("PK_Developer", x => x.ID);
  273. table.ForeignKey(
  274. name: "FK_Developer_Member_MemberID",
  275. column: x => x.MemberID,
  276. principalTable: "Member",
  277. principalColumn: "ID",
  278. onDelete: ReferentialAction.Cascade);
  279. },
  280. comment: "개발자 포털 가입 법인 정보 (Member 1:1)");
  281. migrationBuilder.CreateTable(
  282. name: "DonationAlertConfig",
  283. columns: table => new
  284. {
  285. ID = table.Column<int>(type: "int", nullable: false)
  286. .Annotation("SqlServer:Identity", "1, 1"),
  287. ChannelID = table.Column<int>(type: "int", nullable: false),
  288. MemberID = table.Column<int>(type: "int", nullable: false),
  289. Amount = table.Column<int>(type: "int", nullable: false),
  290. AmountFontColor = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
  291. AmountFontFamily = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  292. AmountFontSize = table.Column<int>(type: "int", nullable: false),
  293. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  294. DisplayDurationSec = table.Column<double>(type: "float", nullable: false),
  295. EnableImage = table.Column<bool>(type: "bit", nullable: false),
  296. EnableSound = table.Column<bool>(type: "bit", nullable: false),
  297. ImageUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  298. IsActive = table.Column<bool>(type: "bit", nullable: false),
  299. MatchType = table.Column<int>(type: "int", nullable: false),
  300. Message = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
  301. MessageFontColor = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
  302. MessageFontFamily = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  303. MessageFontSize = table.Column<int>(type: "int", nullable: false),
  304. NicknameFontColor = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
  305. NicknameFontFamily = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  306. NicknameFontSize = table.Column<int>(type: "int", nullable: false),
  307. PlayDelaySec = table.Column<double>(type: "float", nullable: false),
  308. PopupEffect = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  309. SoundUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  310. TemplateFontColor = table.Column<string>(type: "nvarchar(max)", nullable: false),
  311. TemplateFontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  312. TemplateFontSize = table.Column<int>(type: "int", nullable: false),
  313. TextEffect = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  314. Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
  315. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  316. },
  317. constraints: table =>
  318. {
  319. table.PrimaryKey("PK_DonationAlertConfig", x => x.ID);
  320. table.ForeignKey(
  321. name: "FK_DonationAlertConfig_Channel_ChannelID",
  322. column: x => x.ChannelID,
  323. principalTable: "Channel",
  324. principalColumn: "ID",
  325. onDelete: ReferentialAction.Cascade);
  326. table.ForeignKey(
  327. name: "FK_DonationAlertConfig_Member_MemberID",
  328. column: x => x.MemberID,
  329. principalTable: "Member",
  330. principalColumn: "ID");
  331. },
  332. comment: "후원 알림 위젯 설정");
  333. migrationBuilder.CreateTable(
  334. name: "DonationGoalConfig",
  335. columns: table => new
  336. {
  337. ID = table.Column<int>(type: "int", nullable: false)
  338. .Annotation("SqlServer:Identity", "1, 1"),
  339. ChannelID = table.Column<int>(type: "int", nullable: false),
  340. MemberID = table.Column<int>(type: "int", nullable: false),
  341. AmountFontColor = table.Column<string>(type: "nvarchar(9)", maxLength: 9, nullable: false),
  342. AmountFontFamily = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  343. AmountFontSizePx = table.Column<int>(type: "int", nullable: false),
  344. BarBackgroundColor = table.Column<string>(type: "nvarchar(9)", maxLength: 9, nullable: false),
  345. BarColor = table.Column<string>(type: "nvarchar(9)", maxLength: 9, nullable: false),
  346. BarHeightPx = table.Column<int>(type: "int", nullable: false),
  347. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  348. EndAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  349. IsActive = table.Column<bool>(type: "bit", nullable: false),
  350. IsShowPercent = table.Column<bool>(type: "bit", nullable: false),
  351. Period = table.Column<int>(type: "int", nullable: false, defaultValue: 6),
  352. StartAmount = table.Column<int>(type: "int", nullable: false),
  353. StartAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  354. Style = table.Column<int>(type: "int", nullable: false),
  355. TargetAmount = table.Column<int>(type: "int", nullable: false),
  356. Title = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  357. TitleFontColor = table.Column<string>(type: "nvarchar(9)", maxLength: 9, nullable: false),
  358. TitleFontFamily = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  359. TitleFontSizePx = table.Column<int>(type: "int", nullable: false),
  360. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  361. },
  362. constraints: table =>
  363. {
  364. table.PrimaryKey("PK_DonationGoalConfig", x => x.ID);
  365. table.ForeignKey(
  366. name: "FK_DonationGoalConfig_Channel_ChannelID",
  367. column: x => x.ChannelID,
  368. principalTable: "Channel",
  369. principalColumn: "ID",
  370. onDelete: ReferentialAction.Cascade);
  371. table.ForeignKey(
  372. name: "FK_DonationGoalConfig_Member_MemberID",
  373. column: x => x.MemberID,
  374. principalTable: "Member",
  375. principalColumn: "ID");
  376. },
  377. comment: "후원 목표 위젯 설정");
  378. migrationBuilder.CreateTable(
  379. name: "DonationMeta",
  380. columns: table => new
  381. {
  382. ID = table.Column<int>(type: "int", nullable: false)
  383. .Annotation("SqlServer:Identity", "1, 1"),
  384. ChannelID = table.Column<int>(type: "int", nullable: false),
  385. MemberID = table.Column<int>(type: "int", nullable: false),
  386. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  387. IsAccepting = table.Column<bool>(type: "bit", nullable: false),
  388. IsAudioOnly = table.Column<bool>(type: "bit", nullable: false),
  389. IsPaused = table.Column<bool>(type: "bit", nullable: false),
  390. IsVideoOnly = table.Column<bool>(type: "bit", nullable: false),
  391. MinAmount = table.Column<int>(type: "int", nullable: false),
  392. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  393. },
  394. constraints: table =>
  395. {
  396. table.PrimaryKey("PK_DonationMeta", x => x.ID);
  397. table.ForeignKey(
  398. name: "FK_DonationMeta_Channel_ChannelID",
  399. column: x => x.ChannelID,
  400. principalTable: "Channel",
  401. principalColumn: "ID",
  402. onDelete: ReferentialAction.Cascade);
  403. table.ForeignKey(
  404. name: "FK_DonationMeta_Member_MemberID",
  405. column: x => x.MemberID,
  406. principalTable: "Member",
  407. principalColumn: "ID");
  408. },
  409. comment: "후원 공통 설정");
  410. migrationBuilder.CreateTable(
  411. name: "DonationRankConfig",
  412. columns: table => new
  413. {
  414. ID = table.Column<int>(type: "int", nullable: false)
  415. .Annotation("SqlServer:Identity", "1, 1"),
  416. ChannelID = table.Column<int>(type: "int", nullable: false),
  417. MemberID = table.Column<int>(type: "int", nullable: false),
  418. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  419. EndAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  420. IsActive = table.Column<bool>(type: "bit", nullable: false),
  421. IsShowAmount = table.Column<bool>(type: "bit", nullable: false),
  422. IsShowDonationCount = table.Column<bool>(type: "bit", nullable: false),
  423. IsShowGradeIcon = table.Column<bool>(type: "bit", nullable: false),
  424. IsShowMemberIcon = table.Column<bool>(type: "bit", nullable: false),
  425. MaxRankCount = table.Column<int>(type: "int", nullable: false),
  426. NameDisplayType = table.Column<int>(type: "int", nullable: false),
  427. NameMode = table.Column<bool>(type: "bit", nullable: true),
  428. Period = table.Column<int>(type: "int", nullable: false),
  429. Rank1FontColor = table.Column<string>(type: "nvarchar(max)", nullable: false),
  430. Rank1FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  431. Rank1FontSizePx = table.Column<int>(type: "int", nullable: false),
  432. Rank2FontColor = table.Column<string>(type: "nvarchar(max)", nullable: false),
  433. Rank2FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  434. Rank2FontSizePx = table.Column<int>(type: "int", nullable: false),
  435. Rank3FontColor = table.Column<string>(type: "nvarchar(max)", nullable: false),
  436. Rank3FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  437. Rank3FontSizePx = table.Column<int>(type: "int", nullable: false),
  438. StartAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  439. Theme = table.Column<int>(type: "int", nullable: false),
  440. Title = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false),
  441. TitleFontColor = table.Column<string>(type: "nvarchar(max)", nullable: false),
  442. TitleFontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  443. TitleFontSizePx = table.Column<int>(type: "int", nullable: false),
  444. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  445. },
  446. constraints: table =>
  447. {
  448. table.PrimaryKey("PK_DonationRankConfig", x => x.ID);
  449. table.ForeignKey(
  450. name: "FK_DonationRankConfig_Channel_ChannelID",
  451. column: x => x.ChannelID,
  452. principalTable: "Channel",
  453. principalColumn: "ID",
  454. onDelete: ReferentialAction.Cascade);
  455. table.ForeignKey(
  456. name: "FK_DonationRankConfig_Member_MemberID",
  457. column: x => x.MemberID,
  458. principalTable: "Member",
  459. principalColumn: "ID");
  460. },
  461. comment: "후원 순위 위젯 설정");
  462. migrationBuilder.CreateTable(
  463. name: "DonationRanking",
  464. columns: table => new
  465. {
  466. ID = table.Column<int>(type: "int", nullable: false)
  467. .Annotation("SqlServer:Identity", "1, 1"),
  468. ChannelID = table.Column<int>(type: "int", nullable: false),
  469. SponsorMemberID = table.Column<int>(type: "int", nullable: false),
  470. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  471. DonationCount = table.Column<int>(type: "int", nullable: false),
  472. IsActive = table.Column<bool>(type: "bit", nullable: false),
  473. PeriodEnd = table.Column<DateTime>(type: "datetime2", nullable: true),
  474. PeriodStart = table.Column<DateTime>(type: "datetime2", nullable: false),
  475. PeriodType = table.Column<int>(type: "int", nullable: false),
  476. Rank = table.Column<int>(type: "int", nullable: false),
  477. SponsorName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  478. TotalAmount = table.Column<int>(type: "int", nullable: false),
  479. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  480. },
  481. constraints: table =>
  482. {
  483. table.PrimaryKey("PK_DonationRanking", x => x.ID);
  484. table.ForeignKey(
  485. name: "FK_DonationRanking_Channel_ChannelID",
  486. column: x => x.ChannelID,
  487. principalTable: "Channel",
  488. principalColumn: "ID",
  489. onDelete: ReferentialAction.Cascade);
  490. table.ForeignKey(
  491. name: "FK_DonationRanking_Member_SponsorMemberID",
  492. column: x => x.SponsorMemberID,
  493. principalTable: "Member",
  494. principalColumn: "ID");
  495. },
  496. comment: "후원 순위");
  497. migrationBuilder.CreateTable(
  498. name: "DonorChannelStats",
  499. columns: table => new
  500. {
  501. DonorMemberID = table.Column<int>(type: "int", nullable: false, comment: "후원자 회원 ID"),
  502. ChannelID = table.Column<int>(type: "int", nullable: false, comment: "채널 ID"),
  503. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "생성 일시"),
  504. CumulativeAmount = table.Column<long>(type: "bigint", nullable: false, comment: "누적 후원 금액"),
  505. DonationCount = table.Column<int>(type: "int", nullable: false, comment: "후원 횟수"),
  506. FirstDonatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "첫 후원 일시"),
  507. LastDonatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 후원 일시"),
  508. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시")
  509. },
  510. constraints: table =>
  511. {
  512. table.PrimaryKey("PK_DonorChannelStats", x => new { x.DonorMemberID, x.ChannelID });
  513. table.ForeignKey(
  514. name: "FK_DonorChannelStats_Channel_ChannelID",
  515. column: x => x.ChannelID,
  516. principalTable: "Channel",
  517. principalColumn: "ID");
  518. table.ForeignKey(
  519. name: "FK_DonorChannelStats_Member_DonorMemberID",
  520. column: x => x.DonorMemberID,
  521. principalTable: "Member",
  522. principalColumn: "ID");
  523. },
  524. comment: "후원자×채널 누적 후원 (칭호 획득 판정용)");
  525. migrationBuilder.CreateTable(
  526. name: "GameProductCatalog",
  527. columns: table => new
  528. {
  529. ID = table.Column<int>(type: "int", nullable: false)
  530. .Annotation("SqlServer:Identity", "1, 1"),
  531. GameID = table.Column<int>(type: "int", nullable: false),
  532. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  533. IsActive = table.Column<bool>(type: "bit", nullable: false),
  534. Price = table.Column<int>(type: "int", nullable: false),
  535. ProductID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  536. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  537. },
  538. constraints: table =>
  539. {
  540. table.PrimaryKey("PK_GameProductCatalog", x => x.ID);
  541. table.ForeignKey(
  542. name: "FK_GameProductCatalog_Game_GameID",
  543. column: x => x.GameID,
  544. principalTable: "Game",
  545. principalColumn: "ID",
  546. onDelete: ReferentialAction.Cascade);
  547. },
  548. comment: "게임별 인앱 상품 SKU 정가 카탈로그 (API 결제 보고가 검증용)");
  549. migrationBuilder.CreateTable(
  550. name: "RankingSnapshot",
  551. columns: table => new
  552. {
  553. ID = table.Column<int>(type: "int", nullable: false)
  554. .Annotation("SqlServer:Identity", "1, 1"),
  555. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  556. BroadcastSec = table.Column<long>(type: "bigint", nullable: false, comment: "방송 시간 (초)"),
  557. Category = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true, comment: "카테고리 (전체/게임/버츄얼/토크/음악/먹방)"),
  558. DonorCount = table.Column<int>(type: "int", nullable: false, comment: "후원자 수"),
  559. LikeCount = table.Column<long>(type: "bigint", nullable: false, comment: "좋아요"),
  560. MoneyAmount = table.Column<long>(type: "bigint", nullable: false, comment: "수령/후원 금액"),
  561. Period = table.Column<int>(type: "int", nullable: false, comment: "기간 (1=오늘, 2=어제, 3=이번주, 4=이번달, 5=지난달, 6=전체)"),
  562. PeriodEnd = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "기간 종료"),
  563. PeriodStart = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "기간 시작"),
  564. PreviousRank = table.Column<int>(type: "int", nullable: true, comment: "전일 순위"),
  565. Rank = table.Column<int>(type: "int", nullable: false, comment: "순위"),
  566. Score = table.Column<long>(type: "bigint", nullable: false, comment: "종합 점수"),
  567. SnapshotAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "스냅샷 일시"),
  568. Type = table.Column<int>(type: "int", nullable: false, comment: "랭킹 종류 (1=종합, 2=크리에이터, 3=후원자)"),
  569. ViewCount = table.Column<long>(type: "bigint", nullable: false, comment: "조회수")
  570. },
  571. constraints: table =>
  572. {
  573. table.PrimaryKey("PK_RankingSnapshot", x => x.ID);
  574. table.ForeignKey(
  575. name: "FK_RankingSnapshot_Member_MemberID",
  576. column: x => x.MemberID,
  577. principalTable: "Member",
  578. principalColumn: "ID");
  579. },
  580. comment: "랭킹 스냅샷 (일 1회 집계)");
  581. migrationBuilder.CreateTable(
  582. name: "Settlement",
  583. columns: table => new
  584. {
  585. ID = table.Column<int>(type: "int", nullable: false)
  586. .Annotation("SqlServer:Identity", "1, 1"),
  587. ChannelID = table.Column<int>(type: "int", nullable: false),
  588. MemberID = table.Column<int>(type: "int", nullable: false),
  589. AdminMemo = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  590. ApprovedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  591. FeeAmount = table.Column<int>(type: "int", nullable: false),
  592. GrossAmount = table.Column<int>(type: "int", nullable: false),
  593. NetAmount = table.Column<int>(type: "int", nullable: false),
  594. PaidAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  595. PeriodEnd = table.Column<DateTime>(type: "datetime2", nullable: false),
  596. PeriodStart = table.Column<DateTime>(type: "datetime2", nullable: false),
  597. RequestedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  598. Status = table.Column<int>(type: "int", nullable: false)
  599. },
  600. constraints: table =>
  601. {
  602. table.PrimaryKey("PK_Settlement", x => x.ID);
  603. table.ForeignKey(
  604. name: "FK_Settlement_Channel_ChannelID",
  605. column: x => x.ChannelID,
  606. principalTable: "Channel",
  607. principalColumn: "ID");
  608. table.ForeignKey(
  609. name: "FK_Settlement_Member_MemberID",
  610. column: x => x.MemberID,
  611. principalTable: "Member",
  612. principalColumn: "ID");
  613. },
  614. comment: "정산");
  615. migrationBuilder.CreateTable(
  616. name: "SettlementAccount",
  617. columns: table => new
  618. {
  619. ID = table.Column<int>(type: "int", nullable: false)
  620. .Annotation("SqlServer:Identity", "1, 1"),
  621. ChannelID = table.Column<int>(type: "int", nullable: false),
  622. MemberID = table.Column<int>(type: "int", nullable: false),
  623. AccountHolder = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  624. AccountNumber = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
  625. BankCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
  626. BankName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  627. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  628. IsVerified = table.Column<bool>(type: "bit", nullable: false),
  629. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  630. },
  631. constraints: table =>
  632. {
  633. table.PrimaryKey("PK_SettlementAccount", x => x.ID);
  634. table.ForeignKey(
  635. name: "FK_SettlementAccount_Channel_ChannelID",
  636. column: x => x.ChannelID,
  637. principalTable: "Channel",
  638. principalColumn: "ID");
  639. table.ForeignKey(
  640. name: "FK_SettlementAccount_Member_MemberID",
  641. column: x => x.MemberID,
  642. principalTable: "Member",
  643. principalColumn: "ID");
  644. },
  645. comment: "정산 계좌");
  646. migrationBuilder.CreateTable(
  647. name: "WithdrawalRequest",
  648. columns: table => new
  649. {
  650. ID = table.Column<int>(type: "int", nullable: false)
  651. .Annotation("SqlServer:Identity", "1, 1"),
  652. ChannelID = table.Column<int>(type: "int", nullable: false),
  653. MemberID = table.Column<int>(type: "int", nullable: false),
  654. AccountHolder = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  655. AccountNumber = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
  656. AdminMemo = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  657. BankCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
  658. BankName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  659. DonationAmount = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "후원 수익(Donation) 잔액에서 차감되는 금액"),
  660. IncomeTax = table.Column<int>(type: "int", nullable: false),
  661. LocalTax = table.Column<int>(type: "int", nullable: false),
  662. NetAmount = table.Column<int>(type: "int", nullable: false),
  663. ProcessedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  664. RejectedReason = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  665. RequestedAmount = table.Column<int>(type: "int", nullable: false),
  666. RequestedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  667. Status = table.Column<int>(type: "int", nullable: false),
  668. StoreRevenueAmount = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "상품 판매 수익(StoreRevenue) 잔액에서 차감되는 금액"),
  669. WithholdingTax = table.Column<int>(type: "int", nullable: false)
  670. },
  671. constraints: table =>
  672. {
  673. table.PrimaryKey("PK_WithdrawalRequest", x => x.ID);
  674. table.ForeignKey(
  675. name: "FK_WithdrawalRequest_Channel_ChannelID",
  676. column: x => x.ChannelID,
  677. principalTable: "Channel",
  678. principalColumn: "ID");
  679. table.ForeignKey(
  680. name: "FK_WithdrawalRequest_Member_MemberID",
  681. column: x => x.MemberID,
  682. principalTable: "Member",
  683. principalColumn: "ID");
  684. },
  685. comment: "출금 요청");
  686. migrationBuilder.CreateTable(
  687. name: "ApiApplicationScope",
  688. columns: table => new
  689. {
  690. ID = table.Column<int>(type: "int", nullable: false)
  691. .Annotation("SqlServer:Identity", "1, 1"),
  692. ApplicationID = table.Column<int>(type: "int", nullable: false),
  693. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  694. Scope = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
  695. },
  696. constraints: table =>
  697. {
  698. table.PrimaryKey("PK_ApiApplicationScope", x => x.ID);
  699. table.ForeignKey(
  700. name: "FK_ApiApplicationScope_ApiApplication_ApplicationID",
  701. column: x => x.ApplicationID,
  702. principalTable: "ApiApplication",
  703. principalColumn: "ID",
  704. onDelete: ReferentialAction.Cascade);
  705. },
  706. comment: "앱이 요청한 scope 목록");
  707. migrationBuilder.CreateTable(
  708. name: "ApiCredential",
  709. columns: table => new
  710. {
  711. ID = table.Column<int>(type: "int", nullable: false)
  712. .Annotation("SqlServer:Identity", "1, 1"),
  713. ApplicationID = table.Column<int>(type: "int", nullable: false),
  714. ClientID = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
  715. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  716. LastUsedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  717. RevokedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  718. SecretHash = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  719. SecretHint = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
  720. Status = table.Column<int>(type: "int", nullable: false)
  721. },
  722. constraints: table =>
  723. {
  724. table.PrimaryKey("PK_ApiCredential", x => x.ID);
  725. table.ForeignKey(
  726. name: "FK_ApiCredential_ApiApplication_ApplicationID",
  727. column: x => x.ApplicationID,
  728. principalTable: "ApiApplication",
  729. principalColumn: "ID",
  730. onDelete: ReferentialAction.Cascade);
  731. },
  732. comment: "OAuth2 Client Credentials");
  733. migrationBuilder.CreateTable(
  734. name: "ApiPurchase",
  735. columns: table => new
  736. {
  737. ID = table.Column<int>(type: "int", nullable: false)
  738. .Annotation("SqlServer:Identity", "1, 1"),
  739. ApplicationID = table.Column<int>(type: "int", nullable: false),
  740. ChannelID = table.Column<int>(type: "int", nullable: false),
  741. GameID = table.Column<int>(type: "int", nullable: false),
  742. CanceledAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  743. CatalogPrice = table.Column<int>(type: "int", nullable: true),
  744. CommissionAmount = table.Column<int>(type: "int", nullable: false),
  745. CommissionRate = table.Column<decimal>(type: "decimal(10,7)", precision: 10, scale: 7, nullable: false),
  746. ConfirmDueAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  747. ConfirmedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  748. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  749. CreditedMemberID = table.Column<int>(type: "int", nullable: false),
  750. Marketplace = table.Column<int>(type: "int", nullable: false),
  751. OrderID = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
  752. OrderPrice = table.Column<int>(type: "int", nullable: false),
  753. PriceMismatched = table.Column<bool>(type: "bit", nullable: false),
  754. ProductID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  755. Status = table.Column<int>(type: "int", nullable: false),
  756. SubID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
  757. },
  758. constraints: table =>
  759. {
  760. table.PrimaryKey("PK_ApiPurchase", x => x.ID);
  761. table.ForeignKey(
  762. name: "FK_ApiPurchase_ApiApplication_ApplicationID",
  763. column: x => x.ApplicationID,
  764. principalTable: "ApiApplication",
  765. principalColumn: "ID",
  766. onDelete: ReferentialAction.Restrict);
  767. table.ForeignKey(
  768. name: "FK_ApiPurchase_Channel_ChannelID",
  769. column: x => x.ChannelID,
  770. principalTable: "Channel",
  771. principalColumn: "ID",
  772. onDelete: ReferentialAction.Restrict);
  773. table.ForeignKey(
  774. name: "FK_ApiPurchase_Game_GameID",
  775. column: x => x.GameID,
  776. principalTable: "Game",
  777. principalColumn: "ID",
  778. onDelete: ReferentialAction.Restrict);
  779. },
  780. comment: "게임사 API 결제 보고 원장 (채널 판매 수수료, 14일 보류 후 확정)");
  781. migrationBuilder.CreateTable(
  782. name: "ApiRateLimit",
  783. columns: table => new
  784. {
  785. ID = table.Column<int>(type: "int", nullable: false)
  786. .Annotation("SqlServer:Identity", "1, 1"),
  787. ApplicationID = table.Column<int>(type: "int", nullable: false),
  788. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  789. LimitPerMinute = table.Column<int>(type: "int", nullable: false),
  790. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  791. },
  792. constraints: table =>
  793. {
  794. table.PrimaryKey("PK_ApiRateLimit", x => x.ID);
  795. table.ForeignKey(
  796. name: "FK_ApiRateLimit_ApiApplication_ApplicationID",
  797. column: x => x.ApplicationID,
  798. principalTable: "ApiApplication",
  799. principalColumn: "ID",
  800. onDelete: ReferentialAction.Cascade);
  801. },
  802. comment: "앱별 Rate Limit override");
  803. migrationBuilder.CreateTable(
  804. name: "DonorTitleSelection",
  805. columns: table => new
  806. {
  807. ID = table.Column<int>(type: "int", nullable: false)
  808. .Annotation("SqlServer:Identity", "1, 1"),
  809. ChannelID = table.Column<int>(type: "int", nullable: false, comment: "채널 ID"),
  810. DonorMemberID = table.Column<int>(type: "int", nullable: false, comment: "후원자 회원 ID"),
  811. SelectedTitleID = table.Column<int>(type: "int", nullable: true, comment: "선택 칭호 ID"),
  812. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "생성 일시"),
  813. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시")
  814. },
  815. constraints: table =>
  816. {
  817. table.PrimaryKey("PK_DonorTitleSelection", x => x.ID);
  818. table.ForeignKey(
  819. name: "FK_DonorTitleSelection_ChannelTitle_SelectedTitleID",
  820. column: x => x.SelectedTitleID,
  821. principalTable: "ChannelTitle",
  822. principalColumn: "ID",
  823. onDelete: ReferentialAction.SetNull);
  824. table.ForeignKey(
  825. name: "FK_DonorTitleSelection_Channel_ChannelID",
  826. column: x => x.ChannelID,
  827. principalTable: "Channel",
  828. principalColumn: "ID");
  829. table.ForeignKey(
  830. name: "FK_DonorTitleSelection_Member_DonorMemberID",
  831. column: x => x.DonorMemberID,
  832. principalTable: "Member",
  833. principalColumn: "ID");
  834. },
  835. comment: "후원자가 선택한 채널별 대표 칭호");
  836. migrationBuilder.CreateTable(
  837. name: "CrewInvitation",
  838. columns: table => new
  839. {
  840. ID = table.Column<int>(type: "int", nullable: false)
  841. .Annotation("SqlServer:Identity", "1, 1"),
  842. CrewID = table.Column<int>(type: "int", nullable: false),
  843. InvitedByMemberID = table.Column<int>(type: "int", nullable: false),
  844. TargetMemberID = table.Column<int>(type: "int", nullable: false),
  845. ExpiresAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  846. InvitedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  847. Nickname = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  848. RespondedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  849. Role = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  850. SortOrder = table.Column<int>(type: "int", nullable: false),
  851. Status = table.Column<int>(type: "int", nullable: false)
  852. },
  853. constraints: table =>
  854. {
  855. table.PrimaryKey("PK_CrewInvitation", x => x.ID);
  856. table.ForeignKey(
  857. name: "FK_CrewInvitation_Crew_CrewID",
  858. column: x => x.CrewID,
  859. principalTable: "Crew",
  860. principalColumn: "ID",
  861. onDelete: ReferentialAction.Cascade);
  862. table.ForeignKey(
  863. name: "FK_CrewInvitation_Member_InvitedByMemberID",
  864. column: x => x.InvitedByMemberID,
  865. principalTable: "Member",
  866. principalColumn: "ID");
  867. table.ForeignKey(
  868. name: "FK_CrewInvitation_Member_TargetMemberID",
  869. column: x => x.TargetMemberID,
  870. principalTable: "Member",
  871. principalColumn: "ID");
  872. },
  873. comment: "크루원 초대 이력");
  874. migrationBuilder.CreateTable(
  875. name: "CrewMember",
  876. columns: table => new
  877. {
  878. ID = table.Column<int>(type: "int", nullable: false)
  879. .Annotation("SqlServer:Identity", "1, 1"),
  880. ChannelID = table.Column<int>(type: "int", nullable: true),
  881. CrewID = table.Column<int>(type: "int", nullable: false),
  882. MemberID = table.Column<int>(type: "int", nullable: false),
  883. IsActive = table.Column<bool>(type: "bit", nullable: false),
  884. JoinedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  885. Nickname = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  886. Role = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  887. SortOrder = table.Column<int>(type: "int", nullable: false)
  888. },
  889. constraints: table =>
  890. {
  891. table.PrimaryKey("PK_CrewMember", x => x.ID);
  892. table.ForeignKey(
  893. name: "FK_CrewMember_Channel_ChannelID",
  894. column: x => x.ChannelID,
  895. principalTable: "Channel",
  896. principalColumn: "ID");
  897. table.ForeignKey(
  898. name: "FK_CrewMember_Crew_CrewID",
  899. column: x => x.CrewID,
  900. principalTable: "Crew",
  901. principalColumn: "ID",
  902. onDelete: ReferentialAction.Cascade);
  903. table.ForeignKey(
  904. name: "FK_CrewMember_Member_MemberID",
  905. column: x => x.MemberID,
  906. principalTable: "Member",
  907. principalColumn: "ID");
  908. },
  909. comment: "크루원");
  910. migrationBuilder.CreateTable(
  911. name: "CrewSession",
  912. columns: table => new
  913. {
  914. ID = table.Column<int>(type: "int", nullable: false)
  915. .Annotation("SqlServer:Identity", "1, 1"),
  916. CrewID = table.Column<int>(type: "int", nullable: false),
  917. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  918. EndedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  919. StartedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  920. Status = table.Column<int>(type: "int", nullable: false),
  921. Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
  922. TotalAmount = table.Column<int>(type: "int", nullable: false),
  923. TotalDonationCount = table.Column<int>(type: "int", nullable: false)
  924. },
  925. constraints: table =>
  926. {
  927. table.PrimaryKey("PK_CrewSession", x => x.ID);
  928. table.ForeignKey(
  929. name: "FK_CrewSession_Crew_CrewID",
  930. column: x => x.CrewID,
  931. principalTable: "Crew",
  932. principalColumn: "ID",
  933. onDelete: ReferentialAction.Cascade);
  934. },
  935. comment: "크루 후원 방송 세션");
  936. migrationBuilder.CreateTable(
  937. name: "CrewWidgetConfig",
  938. columns: table => new
  939. {
  940. ID = table.Column<int>(type: "int", nullable: false)
  941. .Annotation("SqlServer:Identity", "1, 1"),
  942. ChannelID = table.Column<int>(type: "int", nullable: false),
  943. CrewID = table.Column<int>(type: "int", nullable: false),
  944. MemberID = table.Column<int>(type: "int", nullable: false),
  945. BgColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
  946. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  947. EndAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  948. IsActive = table.Column<bool>(type: "bit", nullable: false),
  949. IsShowAmount = table.Column<bool>(type: "bit", nullable: false),
  950. IsShowContributionRate = table.Column<bool>(type: "bit", nullable: false),
  951. IsShowDonationCount = table.Column<bool>(type: "bit", nullable: false),
  952. IsShowMemberIcon = table.Column<bool>(type: "bit", nullable: false),
  953. MaxDisplayCount = table.Column<int>(type: "int", nullable: false),
  954. Period = table.Column<int>(type: "int", nullable: false),
  955. Rank1FontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
  956. Rank1FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  957. Rank1FontSizePx = table.Column<int>(type: "int", nullable: false),
  958. Rank2FontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
  959. Rank2FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  960. Rank2FontSizePx = table.Column<int>(type: "int", nullable: false),
  961. Rank3FontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
  962. Rank3FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  963. Rank3FontSizePx = table.Column<int>(type: "int", nullable: false),
  964. RowFontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
  965. RowFontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  966. RowFontSizePx = table.Column<int>(type: "int", nullable: false),
  967. StartAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  968. Theme = table.Column<int>(type: "int", nullable: false),
  969. Title = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false),
  970. TitleFontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
  971. TitleFontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
  972. TitleFontSizePx = table.Column<int>(type: "int", nullable: false),
  973. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  974. },
  975. constraints: table =>
  976. {
  977. table.PrimaryKey("PK_CrewWidgetConfig", x => x.ID);
  978. table.ForeignKey(
  979. name: "FK_CrewWidgetConfig_Channel_ChannelID",
  980. column: x => x.ChannelID,
  981. principalTable: "Channel",
  982. principalColumn: "ID",
  983. onDelete: ReferentialAction.Cascade);
  984. table.ForeignKey(
  985. name: "FK_CrewWidgetConfig_Crew_CrewID",
  986. column: x => x.CrewID,
  987. principalTable: "Crew",
  988. principalColumn: "ID");
  989. table.ForeignKey(
  990. name: "FK_CrewWidgetConfig_Member_MemberID",
  991. column: x => x.MemberID,
  992. principalTable: "Member",
  993. principalColumn: "ID");
  994. },
  995. comment: "크루 위젯 설정");
  996. migrationBuilder.CreateTable(
  997. name: "NiceAuthSession",
  998. columns: table => new
  999. {
  1000. ID = table.Column<int>(type: "int", nullable: false)
  1001. .Annotation("SqlServer:Identity", "1, 1"),
  1002. DeveloperID = table.Column<int>(type: "int", nullable: false),
  1003. CompletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  1004. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1005. ExpiresAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1006. FailReason = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
  1007. Iterators = table.Column<int>(type: "int", nullable: false),
  1008. RequestNo = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  1009. SessionToken = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  1010. Status = table.Column<int>(type: "int", nullable: false),
  1011. Ticket = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
  1012. TransactionID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  1013. WebTransactionID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
  1014. },
  1015. constraints: table =>
  1016. {
  1017. table.PrimaryKey("PK_NiceAuthSession", x => x.ID);
  1018. table.ForeignKey(
  1019. name: "FK_NiceAuthSession_Developer_DeveloperID",
  1020. column: x => x.DeveloperID,
  1021. principalTable: "Developer",
  1022. principalColumn: "ID",
  1023. onDelete: ReferentialAction.Cascade);
  1024. },
  1025. comment: "NICE 통합인증 1회 진행 세션");
  1026. migrationBuilder.CreateTable(
  1027. name: "ApiPurchaseCancel",
  1028. columns: table => new
  1029. {
  1030. ID = table.Column<int>(type: "int", nullable: false)
  1031. .Annotation("SqlServer:Identity", "1, 1"),
  1032. PurchaseID = table.Column<int>(type: "int", nullable: false),
  1033. ApplicationID = table.Column<int>(type: "int", nullable: false),
  1034. ChannelID = table.Column<int>(type: "int", nullable: false),
  1035. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1036. CreditedMemberID = table.Column<int>(type: "int", nullable: false),
  1037. RecoveredAmount = table.Column<int>(type: "int", nullable: false),
  1038. ShortfallAmount = table.Column<int>(type: "int", nullable: false),
  1039. WasConfirmed = table.Column<bool>(type: "bit", nullable: false)
  1040. },
  1041. constraints: table =>
  1042. {
  1043. table.PrimaryKey("PK_ApiPurchaseCancel", x => x.ID);
  1044. table.ForeignKey(
  1045. name: "FK_ApiPurchaseCancel_ApiPurchase_PurchaseID",
  1046. column: x => x.PurchaseID,
  1047. principalTable: "ApiPurchase",
  1048. principalColumn: "ID",
  1049. onDelete: ReferentialAction.Restrict);
  1050. },
  1051. comment: "API 결제 취소 감사 기록 (1 결제 1 취소)");
  1052. migrationBuilder.CreateTable(
  1053. name: "CrewDonationSummary",
  1054. columns: table => new
  1055. {
  1056. ID = table.Column<int>(type: "int", nullable: false)
  1057. .Annotation("SqlServer:Identity", "1, 1"),
  1058. CrewMemberID = table.Column<int>(type: "int", nullable: false),
  1059. CrewSessionID = table.Column<int>(type: "int", nullable: false),
  1060. ContributionRate = table.Column<decimal>(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false),
  1061. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1062. DonationCount = table.Column<int>(type: "int", nullable: false),
  1063. Rank = table.Column<int>(type: "int", nullable: false),
  1064. TotalAmount = table.Column<int>(type: "int", nullable: false),
  1065. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  1066. },
  1067. constraints: table =>
  1068. {
  1069. table.PrimaryKey("PK_CrewDonationSummary", x => x.ID);
  1070. table.ForeignKey(
  1071. name: "FK_CrewDonationSummary_CrewMember_CrewMemberID",
  1072. column: x => x.CrewMemberID,
  1073. principalTable: "CrewMember",
  1074. principalColumn: "ID");
  1075. table.ForeignKey(
  1076. name: "FK_CrewDonationSummary_CrewSession_CrewSessionID",
  1077. column: x => x.CrewSessionID,
  1078. principalTable: "CrewSession",
  1079. principalColumn: "ID",
  1080. onDelete: ReferentialAction.Cascade);
  1081. },
  1082. comment: "크루원 후원 집계");
  1083. migrationBuilder.CreateTable(
  1084. name: "CrewSessionConsent",
  1085. columns: table => new
  1086. {
  1087. ID = table.Column<int>(type: "int", nullable: false)
  1088. .Annotation("SqlServer:Identity", "1, 1"),
  1089. CrewMemberID = table.Column<int>(type: "int", nullable: false),
  1090. CrewSessionID = table.Column<int>(type: "int", nullable: false),
  1091. ConsentedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  1092. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1093. IsConsented = table.Column<bool>(type: "bit", nullable: false)
  1094. },
  1095. constraints: table =>
  1096. {
  1097. table.PrimaryKey("PK_CrewSessionConsent", x => x.ID);
  1098. table.ForeignKey(
  1099. name: "FK_CrewSessionConsent_CrewMember_CrewMemberID",
  1100. column: x => x.CrewMemberID,
  1101. principalTable: "CrewMember",
  1102. principalColumn: "ID");
  1103. table.ForeignKey(
  1104. name: "FK_CrewSessionConsent_CrewSession_CrewSessionID",
  1105. column: x => x.CrewSessionID,
  1106. principalTable: "CrewSession",
  1107. principalColumn: "ID",
  1108. onDelete: ReferentialAction.Cascade);
  1109. },
  1110. comment: "크루원 방송 동의");
  1111. migrationBuilder.CreateTable(
  1112. name: "Donation",
  1113. columns: table => new
  1114. {
  1115. ID = table.Column<int>(type: "int", nullable: false)
  1116. .Annotation("SqlServer:Identity", "1, 1"),
  1117. ChannelID = table.Column<int>(type: "int", nullable: false),
  1118. CrewMemberID = table.Column<int>(type: "int", nullable: true),
  1119. CrewSessionID = table.Column<int>(type: "int", nullable: true),
  1120. ReceiverMemberID = table.Column<int>(type: "int", nullable: false),
  1121. SponsorMemberID = table.Column<int>(type: "int", nullable: false),
  1122. Amount = table.Column<int>(type: "int", nullable: false),
  1123. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1124. FeeAmount = table.Column<int>(type: "int", nullable: false),
  1125. FeeRate = table.Column<decimal>(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false),
  1126. IsTest = table.Column<bool>(type: "bit", nullable: false),
  1127. Message = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  1128. NetAmount = table.Column<int>(type: "int", nullable: false),
  1129. SendName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false)
  1130. },
  1131. constraints: table =>
  1132. {
  1133. table.PrimaryKey("PK_Donation", x => x.ID);
  1134. table.ForeignKey(
  1135. name: "FK_Donation_Channel_ChannelID",
  1136. column: x => x.ChannelID,
  1137. principalTable: "Channel",
  1138. principalColumn: "ID");
  1139. table.ForeignKey(
  1140. name: "FK_Donation_CrewMember_CrewMemberID",
  1141. column: x => x.CrewMemberID,
  1142. principalTable: "CrewMember",
  1143. principalColumn: "ID");
  1144. table.ForeignKey(
  1145. name: "FK_Donation_CrewSession_CrewSessionID",
  1146. column: x => x.CrewSessionID,
  1147. principalTable: "CrewSession",
  1148. principalColumn: "ID");
  1149. table.ForeignKey(
  1150. name: "FK_Donation_Member_ReceiverMemberID",
  1151. column: x => x.ReceiverMemberID,
  1152. principalTable: "Member",
  1153. principalColumn: "ID");
  1154. table.ForeignKey(
  1155. name: "FK_Donation_Member_SponsorMemberID",
  1156. column: x => x.SponsorMemberID,
  1157. principalTable: "Member",
  1158. principalColumn: "ID");
  1159. },
  1160. comment: "후원 내역");
  1161. migrationBuilder.CreateTable(
  1162. name: "DonationAlert",
  1163. columns: table => new
  1164. {
  1165. ID = table.Column<int>(type: "int", nullable: false)
  1166. .Annotation("SqlServer:Identity", "1, 1"),
  1167. DonationID = table.Column<int>(type: "int", nullable: false),
  1168. ReceiverMemberID = table.Column<int>(type: "int", nullable: false),
  1169. SponsorMemberID = table.Column<int>(type: "int", nullable: false),
  1170. ArrivedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  1171. CorrelationID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  1172. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1173. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  1174. StartAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1175. Status = table.Column<int>(type: "int", nullable: false),
  1176. TotalDelayMs = table.Column<double>(type: "float", nullable: true),
  1177. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true)
  1178. },
  1179. constraints: table =>
  1180. {
  1181. table.PrimaryKey("PK_DonationAlert", x => x.ID);
  1182. table.ForeignKey(
  1183. name: "FK_DonationAlert_Donation_DonationID",
  1184. column: x => x.DonationID,
  1185. principalTable: "Donation",
  1186. principalColumn: "ID",
  1187. onDelete: ReferentialAction.Cascade);
  1188. table.ForeignKey(
  1189. name: "FK_DonationAlert_Member_ReceiverMemberID",
  1190. column: x => x.ReceiverMemberID,
  1191. principalTable: "Member",
  1192. principalColumn: "ID");
  1193. table.ForeignKey(
  1194. name: "FK_DonationAlert_Member_SponsorMemberID",
  1195. column: x => x.SponsorMemberID,
  1196. principalTable: "Member",
  1197. principalColumn: "ID");
  1198. },
  1199. comment: "후원 알림 추적");
  1200. migrationBuilder.CreateTable(
  1201. name: "DonationAlertAttempt",
  1202. columns: table => new
  1203. {
  1204. ID = table.Column<int>(type: "int", nullable: false)
  1205. .Annotation("SqlServer:Identity", "1, 1"),
  1206. DonationAlertID = table.Column<int>(type: "int", nullable: false),
  1207. DonationID = table.Column<int>(type: "int", nullable: false),
  1208. IpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  1209. SentAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  1210. UserAgent = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true)
  1211. },
  1212. constraints: table =>
  1213. {
  1214. table.PrimaryKey("PK_DonationAlertAttempt", x => x.ID);
  1215. table.ForeignKey(
  1216. name: "FK_DonationAlertAttempt_DonationAlert_DonationAlertID",
  1217. column: x => x.DonationAlertID,
  1218. principalTable: "DonationAlert",
  1219. principalColumn: "ID",
  1220. onDelete: ReferentialAction.Cascade);
  1221. table.ForeignKey(
  1222. name: "FK_DonationAlertAttempt_Donation_DonationID",
  1223. column: x => x.DonationID,
  1224. principalTable: "Donation",
  1225. principalColumn: "ID");
  1226. },
  1227. comment: "후원 알림 재시도 기록");
  1228. migrationBuilder.CreateIndex(
  1229. name: "IX_ApiApplication_OwnerMemberID",
  1230. table: "ApiApplication",
  1231. column: "OwnerMemberID");
  1232. migrationBuilder.CreateIndex(
  1233. name: "IX_ApiApplication_Status",
  1234. table: "ApiApplication",
  1235. column: "Status");
  1236. migrationBuilder.CreateIndex(
  1237. name: "IX_ApiApplicationScope_ApplicationID_Scope",
  1238. table: "ApiApplicationScope",
  1239. columns: new[] { "ApplicationID", "Scope" },
  1240. unique: true);
  1241. migrationBuilder.CreateIndex(
  1242. name: "IX_ApiCredential_ApplicationID",
  1243. table: "ApiCredential",
  1244. column: "ApplicationID");
  1245. migrationBuilder.CreateIndex(
  1246. name: "IX_ApiCredential_ClientID",
  1247. table: "ApiCredential",
  1248. column: "ClientID",
  1249. unique: true);
  1250. migrationBuilder.CreateIndex(
  1251. name: "IX_ApiPersonalAccessToken_OwnerMemberID",
  1252. table: "ApiPersonalAccessToken",
  1253. column: "OwnerMemberID");
  1254. migrationBuilder.CreateIndex(
  1255. name: "IX_ApiPersonalAccessToken_TokenHash",
  1256. table: "ApiPersonalAccessToken",
  1257. column: "TokenHash",
  1258. unique: true);
  1259. migrationBuilder.CreateIndex(
  1260. name: "IX_ApiPurchase_ApplicationID_Marketplace_OrderID",
  1261. table: "ApiPurchase",
  1262. columns: new[] { "ApplicationID", "Marketplace", "OrderID" },
  1263. unique: true);
  1264. migrationBuilder.CreateIndex(
  1265. name: "IX_ApiPurchase_ChannelID",
  1266. table: "ApiPurchase",
  1267. column: "ChannelID");
  1268. migrationBuilder.CreateIndex(
  1269. name: "IX_ApiPurchase_CreatedAt",
  1270. table: "ApiPurchase",
  1271. column: "CreatedAt");
  1272. migrationBuilder.CreateIndex(
  1273. name: "IX_ApiPurchase_GameID",
  1274. table: "ApiPurchase",
  1275. column: "GameID");
  1276. migrationBuilder.CreateIndex(
  1277. name: "IX_ApiPurchase_Status_ConfirmDueAt",
  1278. table: "ApiPurchase",
  1279. columns: new[] { "Status", "ConfirmDueAt" });
  1280. migrationBuilder.CreateIndex(
  1281. name: "IX_ApiPurchaseCancel_ApplicationID",
  1282. table: "ApiPurchaseCancel",
  1283. column: "ApplicationID");
  1284. migrationBuilder.CreateIndex(
  1285. name: "IX_ApiPurchaseCancel_ChannelID",
  1286. table: "ApiPurchaseCancel",
  1287. column: "ChannelID");
  1288. migrationBuilder.CreateIndex(
  1289. name: "IX_ApiPurchaseCancel_CreatedAt",
  1290. table: "ApiPurchaseCancel",
  1291. column: "CreatedAt");
  1292. migrationBuilder.CreateIndex(
  1293. name: "IX_ApiPurchaseCancel_PurchaseID",
  1294. table: "ApiPurchaseCancel",
  1295. column: "PurchaseID",
  1296. unique: true);
  1297. migrationBuilder.CreateIndex(
  1298. name: "IX_ApiRateLimit_ApplicationID",
  1299. table: "ApiRateLimit",
  1300. column: "ApplicationID",
  1301. unique: true);
  1302. migrationBuilder.CreateIndex(
  1303. name: "IX_ApiRequestLog_ApplicationID",
  1304. table: "ApiRequestLog",
  1305. column: "ApplicationID");
  1306. migrationBuilder.CreateIndex(
  1307. name: "IX_ApiRequestLog_PatID",
  1308. table: "ApiRequestLog",
  1309. column: "PatID");
  1310. migrationBuilder.CreateIndex(
  1311. name: "IX_ApiRequestLog_RequestedAt",
  1312. table: "ApiRequestLog",
  1313. column: "RequestedAt");
  1314. migrationBuilder.CreateIndex(
  1315. name: "IX_ChannelTitle_ChannelID_MinAmount",
  1316. table: "ChannelTitle",
  1317. columns: new[] { "ChannelID", "MinAmount" });
  1318. migrationBuilder.CreateIndex(
  1319. name: "IX_ChannelTitle_ChannelID_SortOrder",
  1320. table: "ChannelTitle",
  1321. columns: new[] { "ChannelID", "SortOrder" });
  1322. migrationBuilder.CreateIndex(
  1323. name: "IX_Crew_ChannelID_IsActive",
  1324. table: "Crew",
  1325. columns: new[] { "ChannelID", "IsActive" });
  1326. migrationBuilder.CreateIndex(
  1327. name: "IX_Crew_InviteCode",
  1328. table: "Crew",
  1329. column: "InviteCode",
  1330. unique: true,
  1331. filter: "[InviteCode] IS NOT NULL");
  1332. migrationBuilder.CreateIndex(
  1333. name: "IX_Crew_MemberID",
  1334. table: "Crew",
  1335. column: "MemberID");
  1336. migrationBuilder.CreateIndex(
  1337. name: "IX_CrewDonationSummary_CrewMemberID",
  1338. table: "CrewDonationSummary",
  1339. column: "CrewMemberID");
  1340. migrationBuilder.CreateIndex(
  1341. name: "IX_CrewDonationSummary_CrewSessionID_CrewMemberID",
  1342. table: "CrewDonationSummary",
  1343. columns: new[] { "CrewSessionID", "CrewMemberID" },
  1344. unique: true);
  1345. migrationBuilder.CreateIndex(
  1346. name: "IX_CrewDonationSummary_CrewSessionID_Rank",
  1347. table: "CrewDonationSummary",
  1348. columns: new[] { "CrewSessionID", "Rank" });
  1349. migrationBuilder.CreateIndex(
  1350. name: "IX_CrewInvitation_CrewID_TargetMemberID_Status",
  1351. table: "CrewInvitation",
  1352. columns: new[] { "CrewID", "TargetMemberID", "Status" });
  1353. migrationBuilder.CreateIndex(
  1354. name: "IX_CrewInvitation_InvitedByMemberID",
  1355. table: "CrewInvitation",
  1356. column: "InvitedByMemberID");
  1357. migrationBuilder.CreateIndex(
  1358. name: "IX_CrewInvitation_Status_ExpiresAt",
  1359. table: "CrewInvitation",
  1360. columns: new[] { "Status", "ExpiresAt" });
  1361. migrationBuilder.CreateIndex(
  1362. name: "IX_CrewInvitation_TargetMemberID",
  1363. table: "CrewInvitation",
  1364. column: "TargetMemberID");
  1365. migrationBuilder.CreateIndex(
  1366. name: "IX_CrewMember_ChannelID",
  1367. table: "CrewMember",
  1368. column: "ChannelID");
  1369. migrationBuilder.CreateIndex(
  1370. name: "IX_CrewMember_CrewID_MemberID",
  1371. table: "CrewMember",
  1372. columns: new[] { "CrewID", "MemberID" },
  1373. unique: true);
  1374. migrationBuilder.CreateIndex(
  1375. name: "IX_CrewMember_MemberID",
  1376. table: "CrewMember",
  1377. column: "MemberID");
  1378. migrationBuilder.CreateIndex(
  1379. name: "IX_CrewSession_CrewID_StartedAt",
  1380. table: "CrewSession",
  1381. columns: new[] { "CrewID", "StartedAt" });
  1382. migrationBuilder.CreateIndex(
  1383. name: "IX_CrewSession_CrewID_Status",
  1384. table: "CrewSession",
  1385. columns: new[] { "CrewID", "Status" });
  1386. migrationBuilder.CreateIndex(
  1387. name: "IX_CrewSessionConsent_CrewMemberID",
  1388. table: "CrewSessionConsent",
  1389. column: "CrewMemberID");
  1390. migrationBuilder.CreateIndex(
  1391. name: "IX_CrewSessionConsent_CrewSessionID_CrewMemberID",
  1392. table: "CrewSessionConsent",
  1393. columns: new[] { "CrewSessionID", "CrewMemberID" },
  1394. unique: true);
  1395. migrationBuilder.CreateIndex(
  1396. name: "IX_CrewWidgetConfig_ChannelID",
  1397. table: "CrewWidgetConfig",
  1398. column: "ChannelID");
  1399. migrationBuilder.CreateIndex(
  1400. name: "IX_CrewWidgetConfig_CrewID",
  1401. table: "CrewWidgetConfig",
  1402. column: "CrewID");
  1403. migrationBuilder.CreateIndex(
  1404. name: "IX_CrewWidgetConfig_MemberID",
  1405. table: "CrewWidgetConfig",
  1406. column: "MemberID");
  1407. migrationBuilder.CreateIndex(
  1408. name: "IX_Developer_ApprovalStatus",
  1409. table: "Developer",
  1410. column: "ApprovalStatus");
  1411. migrationBuilder.CreateIndex(
  1412. name: "IX_Developer_BusinessNumber",
  1413. table: "Developer",
  1414. column: "BusinessNumber");
  1415. migrationBuilder.CreateIndex(
  1416. name: "IX_Developer_MemberID",
  1417. table: "Developer",
  1418. column: "MemberID",
  1419. unique: true);
  1420. migrationBuilder.CreateIndex(
  1421. name: "IX_Donation_ChannelID",
  1422. table: "Donation",
  1423. column: "ChannelID");
  1424. migrationBuilder.CreateIndex(
  1425. name: "IX_Donation_ChannelID_CreatedAt",
  1426. table: "Donation",
  1427. columns: new[] { "ChannelID", "CreatedAt" });
  1428. migrationBuilder.CreateIndex(
  1429. name: "IX_Donation_CrewMemberID",
  1430. table: "Donation",
  1431. column: "CrewMemberID");
  1432. migrationBuilder.CreateIndex(
  1433. name: "IX_Donation_CrewSessionID",
  1434. table: "Donation",
  1435. column: "CrewSessionID");
  1436. migrationBuilder.CreateIndex(
  1437. name: "IX_Donation_ReceiverMemberID",
  1438. table: "Donation",
  1439. column: "ReceiverMemberID");
  1440. migrationBuilder.CreateIndex(
  1441. name: "IX_Donation_SponsorMemberID",
  1442. table: "Donation",
  1443. column: "SponsorMemberID");
  1444. migrationBuilder.CreateIndex(
  1445. name: "IX_Donation_SponsorMemberID_ReceiverMemberID",
  1446. table: "Donation",
  1447. columns: new[] { "SponsorMemberID", "ReceiverMemberID" });
  1448. migrationBuilder.CreateIndex(
  1449. name: "IX_DonationAlert_CorrelationID",
  1450. table: "DonationAlert",
  1451. column: "CorrelationID",
  1452. unique: true);
  1453. migrationBuilder.CreateIndex(
  1454. name: "IX_DonationAlert_DonationID",
  1455. table: "DonationAlert",
  1456. column: "DonationID",
  1457. unique: true);
  1458. migrationBuilder.CreateIndex(
  1459. name: "IX_DonationAlert_ReceiverMemberID_Status_CreatedAt",
  1460. table: "DonationAlert",
  1461. columns: new[] { "ReceiverMemberID", "Status", "CreatedAt" },
  1462. descending: new[] { false, false, true });
  1463. migrationBuilder.CreateIndex(
  1464. name: "IX_DonationAlert_SponsorMemberID",
  1465. table: "DonationAlert",
  1466. column: "SponsorMemberID");
  1467. migrationBuilder.CreateIndex(
  1468. name: "IX_DonationAlert_Status",
  1469. table: "DonationAlert",
  1470. column: "Status");
  1471. migrationBuilder.CreateIndex(
  1472. name: "IX_DonationAlertAttempt_DonationAlertID",
  1473. table: "DonationAlertAttempt",
  1474. column: "DonationAlertID");
  1475. migrationBuilder.CreateIndex(
  1476. name: "IX_DonationAlertAttempt_DonationID_DonationAlertID",
  1477. table: "DonationAlertAttempt",
  1478. columns: new[] { "DonationID", "DonationAlertID" });
  1479. migrationBuilder.CreateIndex(
  1480. name: "IX_DonationAlertConfig_ChannelID_IsActive",
  1481. table: "DonationAlertConfig",
  1482. columns: new[] { "ChannelID", "IsActive" });
  1483. migrationBuilder.CreateIndex(
  1484. name: "IX_DonationAlertConfig_ChannelID_MatchType_Amount",
  1485. table: "DonationAlertConfig",
  1486. columns: new[] { "ChannelID", "MatchType", "Amount" });
  1487. migrationBuilder.CreateIndex(
  1488. name: "IX_DonationAlertConfig_ChannelID_MemberID_Amount",
  1489. table: "DonationAlertConfig",
  1490. columns: new[] { "ChannelID", "MemberID", "Amount" });
  1491. migrationBuilder.CreateIndex(
  1492. name: "IX_DonationAlertConfig_MemberID",
  1493. table: "DonationAlertConfig",
  1494. column: "MemberID");
  1495. migrationBuilder.CreateIndex(
  1496. name: "IX_DonationGoalConfig_ChannelID_IsActive",
  1497. table: "DonationGoalConfig",
  1498. columns: new[] { "ChannelID", "IsActive" });
  1499. migrationBuilder.CreateIndex(
  1500. name: "IX_DonationGoalConfig_ChannelID_MemberID",
  1501. table: "DonationGoalConfig",
  1502. columns: new[] { "ChannelID", "MemberID" });
  1503. migrationBuilder.CreateIndex(
  1504. name: "IX_DonationGoalConfig_MemberID",
  1505. table: "DonationGoalConfig",
  1506. column: "MemberID");
  1507. migrationBuilder.CreateIndex(
  1508. name: "IX_DonationMeta_ChannelID_MemberID",
  1509. table: "DonationMeta",
  1510. columns: new[] { "ChannelID", "MemberID" },
  1511. unique: true);
  1512. migrationBuilder.CreateIndex(
  1513. name: "IX_DonationMeta_MemberID",
  1514. table: "DonationMeta",
  1515. column: "MemberID");
  1516. migrationBuilder.CreateIndex(
  1517. name: "IX_DonationRankConfig_ChannelID",
  1518. table: "DonationRankConfig",
  1519. column: "ChannelID");
  1520. migrationBuilder.CreateIndex(
  1521. name: "IX_DonationRankConfig_MemberID",
  1522. table: "DonationRankConfig",
  1523. column: "MemberID");
  1524. migrationBuilder.CreateIndex(
  1525. name: "IX_DonationRanking_ChannelID_PeriodType_PeriodStart_Rank",
  1526. table: "DonationRanking",
  1527. columns: new[] { "ChannelID", "PeriodType", "PeriodStart", "Rank" });
  1528. migrationBuilder.CreateIndex(
  1529. name: "IX_DonationRanking_ChannelID_SponsorMemberID_PeriodType_PeriodStart",
  1530. table: "DonationRanking",
  1531. columns: new[] { "ChannelID", "SponsorMemberID", "PeriodType", "PeriodStart" },
  1532. unique: true);
  1533. migrationBuilder.CreateIndex(
  1534. name: "IX_DonationRanking_SponsorMemberID",
  1535. table: "DonationRanking",
  1536. column: "SponsorMemberID");
  1537. migrationBuilder.CreateIndex(
  1538. name: "IX_DonorChannelStats_ChannelID_CumulativeAmount",
  1539. table: "DonorChannelStats",
  1540. columns: new[] { "ChannelID", "CumulativeAmount" },
  1541. descending: new[] { false, true });
  1542. migrationBuilder.CreateIndex(
  1543. name: "IX_DonorTitleSelection_ChannelID",
  1544. table: "DonorTitleSelection",
  1545. column: "ChannelID");
  1546. migrationBuilder.CreateIndex(
  1547. name: "IX_DonorTitleSelection_DonorMemberID_ChannelID",
  1548. table: "DonorTitleSelection",
  1549. columns: new[] { "DonorMemberID", "ChannelID" },
  1550. unique: true);
  1551. migrationBuilder.CreateIndex(
  1552. name: "IX_DonorTitleSelection_SelectedTitleID",
  1553. table: "DonorTitleSelection",
  1554. column: "SelectedTitleID");
  1555. migrationBuilder.CreateIndex(
  1556. name: "IX_GameProductCatalog_GameID_ProductID",
  1557. table: "GameProductCatalog",
  1558. columns: new[] { "GameID", "ProductID" },
  1559. unique: true);
  1560. migrationBuilder.CreateIndex(
  1561. name: "IX_NiceAuthSession_DeveloperID_CreatedAt",
  1562. table: "NiceAuthSession",
  1563. columns: new[] { "DeveloperID", "CreatedAt" });
  1564. migrationBuilder.CreateIndex(
  1565. name: "IX_NiceAuthSession_SessionToken",
  1566. table: "NiceAuthSession",
  1567. column: "SessionToken",
  1568. unique: true);
  1569. migrationBuilder.CreateIndex(
  1570. name: "IX_NiceAuthSession_Status",
  1571. table: "NiceAuthSession",
  1572. column: "Status");
  1573. migrationBuilder.CreateIndex(
  1574. name: "IX_RankingSnapshot_MemberID",
  1575. table: "RankingSnapshot",
  1576. column: "MemberID");
  1577. migrationBuilder.CreateIndex(
  1578. name: "IX_RankingSnapshot_SnapshotAt",
  1579. table: "RankingSnapshot",
  1580. column: "SnapshotAt",
  1581. descending: new bool[0]);
  1582. migrationBuilder.CreateIndex(
  1583. name: "IX_RankingSnapshot_Type_Period_Category_MemberID",
  1584. table: "RankingSnapshot",
  1585. columns: new[] { "Type", "Period", "Category", "MemberID" },
  1586. unique: true,
  1587. filter: "[Category] IS NOT NULL");
  1588. migrationBuilder.CreateIndex(
  1589. name: "IX_RankingSnapshot_Type_Period_Category_Rank",
  1590. table: "RankingSnapshot",
  1591. columns: new[] { "Type", "Period", "Category", "Rank" });
  1592. migrationBuilder.CreateIndex(
  1593. name: "IX_Settlement_ChannelID_PeriodStart_PeriodEnd",
  1594. table: "Settlement",
  1595. columns: new[] { "ChannelID", "PeriodStart", "PeriodEnd" });
  1596. migrationBuilder.CreateIndex(
  1597. name: "IX_Settlement_MemberID",
  1598. table: "Settlement",
  1599. column: "MemberID");
  1600. migrationBuilder.CreateIndex(
  1601. name: "IX_Settlement_Status",
  1602. table: "Settlement",
  1603. column: "Status");
  1604. migrationBuilder.CreateIndex(
  1605. name: "IX_SettlementAccount_ChannelID_MemberID",
  1606. table: "SettlementAccount",
  1607. columns: new[] { "ChannelID", "MemberID" });
  1608. migrationBuilder.CreateIndex(
  1609. name: "IX_SettlementAccount_MemberID",
  1610. table: "SettlementAccount",
  1611. column: "MemberID");
  1612. migrationBuilder.CreateIndex(
  1613. name: "IX_WithdrawalRequest_ChannelID",
  1614. table: "WithdrawalRequest",
  1615. column: "ChannelID");
  1616. migrationBuilder.CreateIndex(
  1617. name: "IX_WithdrawalRequest_MemberID_RequestedAt",
  1618. table: "WithdrawalRequest",
  1619. columns: new[] { "MemberID", "RequestedAt" });
  1620. migrationBuilder.CreateIndex(
  1621. name: "IX_WithdrawalRequest_MemberID_Status",
  1622. table: "WithdrawalRequest",
  1623. columns: new[] { "MemberID", "Status" });
  1624. }
  1625. }
  1626. }