20260208090603_AddForumEntities.cs 106 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Infrastructure.Persistence.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class AddForumEntities : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "BoardGroup",
  14. columns: table => new
  15. {
  16. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. Code = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false, comment: "게시판 분류 주소"),
  19. Name = table.Column<string>(type: "nvarchar(70)", maxLength: 70, nullable: false, comment: "게시판 분류 명"),
  20. Order = table.Column<short>(type: "smallint", nullable: false, comment: "순서"),
  21. Boards = table.Column<short>(type: "smallint", nullable: false, comment: "게시판 수"),
  22. Posts = table.Column<int>(type: "int", nullable: false, comment: "게시글 수"),
  23. Comments = table.Column<int>(type: "int", nullable: false, comment: "댓글 수"),
  24. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  25. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  26. },
  27. constraints: table =>
  28. {
  29. table.PrimaryKey("PK_BoardGroup", x => x.ID);
  30. },
  31. comment: "게시판 분류");
  32. migrationBuilder.CreateTable(
  33. name: "Tag",
  34. columns: table => new
  35. {
  36. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  37. .Annotation("SqlServer:Identity", "1, 1"),
  38. Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
  39. Slug = table.Column<string>(type: "nvarchar(450)", nullable: false),
  40. UsageCount = table.Column<long>(type: "bigint", nullable: false),
  41. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  42. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  43. },
  44. constraints: table =>
  45. {
  46. table.PrimaryKey("PK_Tag", x => x.ID);
  47. },
  48. comment: "태그");
  49. migrationBuilder.CreateTable(
  50. name: "Board",
  51. columns: table => new
  52. {
  53. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  54. .Annotation("SqlServer:Identity", "1, 1"),
  55. BoardGroupID = table.Column<int>(type: "int", nullable: false, comment: "분류 ID"),
  56. Code = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false, comment: "게시판 주소"),
  57. Name = table.Column<string>(type: "nvarchar(70)", maxLength: 70, nullable: false, comment: "게시판 이름"),
  58. Order = table.Column<short>(type: "smallint", nullable: false, comment: "순서"),
  59. IsSearch = table.Column<bool>(type: "bit", nullable: false, comment: "검색 여부"),
  60. IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
  61. Posts = table.Column<int>(type: "int", nullable: false, comment: "게시글 수"),
  62. Comments = table.Column<int>(type: "int", nullable: false, comment: "댓글 수"),
  63. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  64. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  65. },
  66. constraints: table =>
  67. {
  68. table.PrimaryKey("PK_Board", x => x.ID);
  69. table.ForeignKey(
  70. name: "FK_Board_BoardGroup_BoardGroupID",
  71. column: x => x.BoardGroupID,
  72. principalTable: "BoardGroup",
  73. principalColumn: "ID",
  74. onDelete: ReferentialAction.Restrict);
  75. },
  76. comment: "게시판");
  77. migrationBuilder.CreateTable(
  78. name: "BoardManager",
  79. columns: table => new
  80. {
  81. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  82. .Annotation("SqlServer:Identity", "1, 1"),
  83. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  84. MemberID = table.Column<int>(type: "int", nullable: false, comment: "관리자 ID"),
  85. CanEdit = table.Column<bool>(type: "bit", nullable: false, comment: "수정 권한"),
  86. CanDelete = table.Column<bool>(type: "bit", nullable: false, comment: "삭제 권한"),
  87. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  88. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  89. },
  90. constraints: table =>
  91. {
  92. table.PrimaryKey("PK_BoardManager", x => x.ID);
  93. table.ForeignKey(
  94. name: "FK_BoardManager_Board_BoardID",
  95. column: x => x.BoardID,
  96. principalTable: "Board",
  97. principalColumn: "ID",
  98. onDelete: ReferentialAction.Cascade);
  99. table.ForeignKey(
  100. name: "FK_BoardManager_Member_MemberID",
  101. column: x => x.MemberID,
  102. principalTable: "Member",
  103. principalColumn: "ID",
  104. onDelete: ReferentialAction.Cascade);
  105. },
  106. comment: "게시판 관리자");
  107. migrationBuilder.CreateTable(
  108. name: "BoardMeta",
  109. columns: table => new
  110. {
  111. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  112. .Annotation("SqlServer:Identity", "1, 1"),
  113. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  114. List_ShowHeader = table.Column<bool>(type: "bit", nullable: false),
  115. List_HeaderContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  116. List_ShowFooter = table.Column<bool>(type: "bit", nullable: false),
  117. List_FooterContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  118. List_Layout = table.Column<byte>(type: "tinyint", nullable: true),
  119. List_Sort = table.Column<byte>(type: "tinyint", nullable: true),
  120. List_PerPage = table.Column<byte>(type: "tinyint", nullable: false),
  121. List_AlwaysShowWriteButton = table.Column<bool>(type: "bit", nullable: false),
  122. List_ShowFooterListView = table.Column<bool>(type: "bit", nullable: false),
  123. List_IsNewIcon = table.Column<bool>(type: "bit", nullable: false),
  124. List_IsHotIcon = table.Column<bool>(type: "bit", nullable: false),
  125. List_ExceptNotice = table.Column<bool>(type: "bit", nullable: false),
  126. List_ExceptSpeaker = table.Column<bool>(type: "bit", nullable: false),
  127. View_AllowBookmark = table.Column<bool>(type: "bit", nullable: false),
  128. View_AllowLike = table.Column<bool>(type: "bit", nullable: false),
  129. View_AllowDislike = table.Column<bool>(type: "bit", nullable: false),
  130. View_AllowPrint = table.Column<bool>(type: "bit", nullable: false),
  131. View_AllowSnsShare = table.Column<bool>(type: "bit", nullable: false),
  132. View_AllowPrevNextBotton = table.Column<bool>(type: "bit", nullable: false),
  133. View_AllowBlame = table.Column<bool>(type: "bit", nullable: false),
  134. View_BlameHideCount = table.Column<int>(type: "int", nullable: false),
  135. View_AllowContentLinkTargetBlank = table.Column<bool>(type: "bit", nullable: false),
  136. View_AllowPostUrlCopy = table.Column<bool>(type: "bit", nullable: false),
  137. View_AllowPostUrlQrCode = table.Column<bool>(type: "bit", nullable: false),
  138. View_ShowMemberPhoto = table.Column<bool>(type: "bit", nullable: false),
  139. View_ShowMemberIcon = table.Column<bool>(type: "bit", nullable: false),
  140. View_ShowMemberRegDate = table.Column<bool>(type: "bit", nullable: false),
  141. View_ShowMemberSummary = table.Column<bool>(type: "bit", nullable: false),
  142. Write_ShowHeader = table.Column<bool>(type: "bit", nullable: false),
  143. Write_HeaderContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  144. Write_ShowFooter = table.Column<bool>(type: "bit", nullable: false),
  145. Write_FooterContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  146. Write_DefaultSubject = table.Column<string>(type: "nvarchar(max)", nullable: true),
  147. Write_DefaultContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  148. Write_AllowEditor = table.Column<bool>(type: "bit", nullable: false),
  149. Write_AllowPrefix = table.Column<bool>(type: "bit", nullable: false),
  150. Write_RequiredPrefix = table.Column<bool>(type: "bit", nullable: false),
  151. Write_AllowSecret = table.Column<bool>(type: "bit", nullable: false),
  152. Write_AllowTag = table.Column<bool>(type: "bit", nullable: false),
  153. Write_TagLimit = table.Column<byte>(type: "tinyint", nullable: false),
  154. Write_AllowImage = table.Column<bool>(type: "bit", nullable: false),
  155. Write_ImageUploadLimit = table.Column<byte>(type: "tinyint", nullable: false),
  156. Write_ImageUploadMaxSize = table.Column<int>(type: "int", nullable: false),
  157. Write_AllowMedia = table.Column<bool>(type: "bit", nullable: false),
  158. Write_MediaUploadLimit = table.Column<byte>(type: "tinyint", nullable: false),
  159. Write_AllowFile = table.Column<bool>(type: "bit", nullable: false),
  160. Write_FileUploadLimit = table.Column<byte>(type: "tinyint", nullable: false),
  161. Write_FileUploadMaxSize = table.Column<int>(type: "int", nullable: false),
  162. Write_FileUploadExtension = table.Column<string>(type: "nvarchar(max)", nullable: true),
  163. Comment_EnableComment = table.Column<bool>(type: "bit", nullable: false),
  164. Comment_PerPage = table.Column<int>(type: "int", nullable: false),
  165. Comment_AllowLike = table.Column<bool>(type: "bit", nullable: false),
  166. Comment_AllowDisLike = table.Column<bool>(type: "bit", nullable: false),
  167. Comment_ShowMemberPhoto = table.Column<bool>(type: "bit", nullable: false),
  168. Comment_ShowMemberIcon = table.Column<bool>(type: "bit", nullable: false),
  169. Comment_ContentPlaceholder = table.Column<string>(type: "nvarchar(max)", nullable: true),
  170. Comment_MinContentLength = table.Column<int>(type: "int", nullable: false),
  171. Comment_MaxContentLength = table.Column<int>(type: "int", nullable: false),
  172. Comment_EnableEditor = table.Column<bool>(type: "bit", nullable: false),
  173. Comment_AllowSecret = table.Column<bool>(type: "bit", nullable: false),
  174. Comment_BlameHideCount = table.Column<int>(type: "int", nullable: false),
  175. Comment_DeleteProtectionDays = table.Column<int>(type: "int", nullable: false),
  176. Comment_UpdateProtectionDays = table.Column<int>(type: "int", nullable: false),
  177. Comment_AllowDeleteProtection = table.Column<bool>(type: "bit", nullable: false),
  178. Comment_AllowUpdateProtection = table.Column<bool>(type: "bit", nullable: false),
  179. Comment_EnableCommentUpdateLog = table.Column<bool>(type: "bit", nullable: false),
  180. General_DeleteProtectionDays = table.Column<int>(type: "int", nullable: false),
  181. General_UpdateProtectionDays = table.Column<int>(type: "int", nullable: false),
  182. General_AllowDeleteProtection = table.Column<bool>(type: "bit", nullable: false),
  183. General_AllowUpdateProtection = table.Column<bool>(type: "bit", nullable: false),
  184. General_EnableFileDownLog = table.Column<bool>(type: "bit", nullable: false),
  185. General_EnableLinkClickLog = table.Column<bool>(type: "bit", nullable: false),
  186. General_EnablePostUpdateLog = table.Column<bool>(type: "bit", nullable: false),
  187. Permission_BoardAccess = table.Column<short>(type: "smallint", nullable: false),
  188. Permission_PostView = table.Column<short>(type: "smallint", nullable: false),
  189. Permission_PostWrite = table.Column<short>(type: "smallint", nullable: false),
  190. Permission_CommentView = table.Column<short>(type: "smallint", nullable: false),
  191. Permission_CommentWrite = table.Column<short>(type: "smallint", nullable: false),
  192. Permission_ReplyWrite = table.Column<short>(type: "smallint", nullable: false),
  193. Permission_FileUpload = table.Column<short>(type: "smallint", nullable: false),
  194. Permission_FileDownload = table.Column<short>(type: "smallint", nullable: false),
  195. Notify_PostWriteNotify = table.Column<byte>(type: "tinyint", nullable: true),
  196. Notify_CommentWriteNotify = table.Column<byte>(type: "tinyint", nullable: true),
  197. Notify_ReplyWriteNotify = table.Column<byte>(type: "tinyint", nullable: true),
  198. NotifyTemplate_PostWriteEmailNotifySubject = table.Column<string>(type: "nvarchar(max)", nullable: true),
  199. NotifyTemplate_PostWriteEmailNotifyContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  200. NotifyTemplate_CommentWriteEmailNotifySubject = table.Column<string>(type: "nvarchar(max)", nullable: true),
  201. NotifyTemplate_CommentWriteEmailNotifyContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  202. NotifyTemplate_ReplyWriteEmailNotifySubject = table.Column<string>(type: "nvarchar(max)", nullable: true),
  203. NotifyTemplate_ReplyWriteEmailNotifyContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  204. Exp_EnableExp = table.Column<bool>(type: "bit", nullable: false),
  205. Exp_ShowExpGuide = table.Column<bool>(type: "bit", nullable: false),
  206. Exp_PostWriteExp = table.Column<int>(type: "int", nullable: false),
  207. Exp_CommentWriteExp = table.Column<int>(type: "int", nullable: false),
  208. Exp_FileUploadExp = table.Column<int>(type: "int", nullable: false),
  209. Exp_FileDownloadExp = table.Column<short>(type: "smallint", nullable: false),
  210. Exp_OtherPostReadExp = table.Column<short>(type: "smallint", nullable: false),
  211. Exp_OtherPostLikeExp = table.Column<int>(type: "int", nullable: false),
  212. Exp_OtherPostDisLikeExp = table.Column<int>(type: "int", nullable: false),
  213. Exp_OtherCommentLikeExp = table.Column<int>(type: "int", nullable: false),
  214. Exp_OtherCommentDisLikeExp = table.Column<int>(type: "int", nullable: false),
  215. Exp_OwnPostReadExp = table.Column<int>(type: "int", nullable: false),
  216. Exp_OwnPostLikeExp = table.Column<int>(type: "int", nullable: false),
  217. Exp_OwnPostDisLikeExp = table.Column<short>(type: "smallint", nullable: false),
  218. Exp_OwnCommentLikeExp = table.Column<int>(type: "int", nullable: false),
  219. Exp_OwnCommentDisLikeExp = table.Column<short>(type: "smallint", nullable: false),
  220. Exp_PostWriteUndoExp = table.Column<int>(type: "int", nullable: false),
  221. Exp_CommentWriteUndoExp = table.Column<int>(type: "int", nullable: false),
  222. Exp_FileUploadUndoExp = table.Column<int>(type: "int", nullable: false),
  223. Exp_OtherPostReadUndoExp = table.Column<int>(type: "int", nullable: false),
  224. Exp_OtherPostLikeUndoExp = table.Column<int>(type: "int", nullable: false),
  225. Exp_OtherPostDisLikeUndoExp = table.Column<int>(type: "int", nullable: false),
  226. Exp_OtherCommentLikeUndoExp = table.Column<int>(type: "int", nullable: false),
  227. Exp_OtherCommentDisLikeUndoExp = table.Column<int>(type: "int", nullable: false),
  228. Exp_OwnPostReadUndoExp = table.Column<int>(type: "int", nullable: false),
  229. Exp_OwnPostLikeUndoExp = table.Column<int>(type: "int", nullable: false),
  230. Exp_OwnPostDisLikeUndoExp = table.Column<int>(type: "int", nullable: false),
  231. Exp_OwnCommentLikeUndoExp = table.Column<int>(type: "int", nullable: false),
  232. Exp_OwnCommentDisLikeUndoExp = table.Column<int>(type: "int", nullable: false),
  233. Exp_PostWriteExpWithinDays = table.Column<int>(type: "int", nullable: false),
  234. Exp_CommentWriteExpWithinDays = table.Column<int>(type: "int", nullable: false),
  235. Exp_FileUploadExpWithinDays = table.Column<int>(type: "int", nullable: false),
  236. Exp_OtherPostReadExpWithinDays = table.Column<int>(type: "int", nullable: false),
  237. Exp_OtherPostLikeExpWithinDays = table.Column<int>(type: "int", nullable: false),
  238. Exp_OtherPostDisLikeExpWithinDays = table.Column<int>(type: "int", nullable: false),
  239. Exp_OtherCommentLikeExpWithinDays = table.Column<int>(type: "int", nullable: false),
  240. Exp_OtherCommentDisLikeExpWithinDays = table.Column<int>(type: "int", nullable: false),
  241. Exp_OwnPostReadExpWithinDays = table.Column<int>(type: "int", nullable: false),
  242. Exp_OwnPostLikeExpWithinDays = table.Column<int>(type: "int", nullable: false),
  243. Exp_OwnPostDisLikeExpWithinDays = table.Column<int>(type: "int", nullable: false),
  244. Exp_OwnCommentLikeExpWithinDays = table.Column<int>(type: "int", nullable: false),
  245. Exp_OwnCommentDisLikeExpWithinDays = table.Column<int>(type: "int", nullable: false)
  246. },
  247. constraints: table =>
  248. {
  249. table.PrimaryKey("PK_BoardMeta", x => x.ID);
  250. table.ForeignKey(
  251. name: "FK_BoardMeta_Board_BoardID",
  252. column: x => x.BoardID,
  253. principalTable: "Board",
  254. principalColumn: "ID",
  255. onDelete: ReferentialAction.Cascade);
  256. },
  257. comment: "게시판 설정");
  258. migrationBuilder.CreateTable(
  259. name: "BoardPrefix",
  260. columns: table => new
  261. {
  262. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  263. .Annotation("SqlServer:Identity", "1, 1"),
  264. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  265. Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "말머리"),
  266. Color = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true, comment: "색상"),
  267. Order = table.Column<short>(type: "smallint", nullable: false, comment: "정렬 순서"),
  268. Posts = table.Column<int>(type: "int", nullable: false, comment: "사용 게시글 수"),
  269. IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
  270. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  271. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  272. },
  273. constraints: table =>
  274. {
  275. table.PrimaryKey("PK_BoardPrefix", x => x.ID);
  276. table.ForeignKey(
  277. name: "FK_BoardPrefix_Board_BoardID",
  278. column: x => x.BoardID,
  279. principalTable: "Board",
  280. principalColumn: "ID",
  281. onDelete: ReferentialAction.Cascade);
  282. },
  283. comment: "게시판 말머리");
  284. migrationBuilder.CreateTable(
  285. name: "Post",
  286. columns: table => new
  287. {
  288. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  289. .Annotation("SqlServer:Identity", "1, 1"),
  290. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  291. BoardPrefixID = table.Column<int>(type: "int", nullable: true, comment: "게시글 말머리 ID"),
  292. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  293. Subject = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "제목"),
  294. Content = table.Column<string>(type: "nvarchar(max)", maxLength: 8000, nullable: false, comment: "내용"),
  295. SID = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "회원 SID"),
  296. Email = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: true, comment: "회원 이메일"),
  297. Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "회원 이름"),
  298. Thumbnail = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "대표 이미지"),
  299. IsReply = table.Column<bool>(type: "bit", nullable: false, comment: "답변 여부"),
  300. IsAnonymous = table.Column<bool>(type: "bit", nullable: false, comment: "익명 글 여부"),
  301. IsSecret = table.Column<bool>(type: "bit", nullable: false, comment: "비밀글 여부"),
  302. IsNotice = table.Column<bool>(type: "bit", nullable: false, comment: "일반 공지 여부"),
  303. IsSpeaker = table.Column<bool>(type: "bit", nullable: false, comment: "전체 공지 여부"),
  304. IsDeleted = table.Column<bool>(type: "bit", nullable: false, comment: "삭제 여부"),
  305. Views = table.Column<int>(type: "int", nullable: false, comment: "조회 수"),
  306. Likes = table.Column<int>(type: "int", nullable: false, comment: "좋아요"),
  307. Dislikes = table.Column<int>(type: "int", nullable: false, comment: "싫어요"),
  308. Comments = table.Column<int>(type: "int", nullable: false, comment: "댓글 수"),
  309. Bookmarks = table.Column<int>(type: "int", nullable: false, comment: "즐겨찾기 수"),
  310. Reports = table.Column<int>(type: "int", nullable: false, comment: "신고 수"),
  311. Images = table.Column<byte>(type: "tinyint", nullable: false, comment: "이미지 수"),
  312. Medias = table.Column<byte>(type: "tinyint", nullable: false, comment: "미디어 수"),
  313. Files = table.Column<byte>(type: "tinyint", nullable: false, comment: "파일 수"),
  314. Tags = table.Column<byte>(type: "tinyint", nullable: false, comment: "Tag 수"),
  315. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP"),
  316. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-Agent"),
  317. LastReplyUpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 답변 일시"),
  318. LastCommentUpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 댓글 일시"),
  319. DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "삭제 일시"),
  320. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  321. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  322. },
  323. constraints: table =>
  324. {
  325. table.PrimaryKey("PK_Post", x => x.ID);
  326. table.ForeignKey(
  327. name: "FK_Post_BoardPrefix_BoardPrefixID",
  328. column: x => x.BoardPrefixID,
  329. principalTable: "BoardPrefix",
  330. principalColumn: "ID",
  331. onDelete: ReferentialAction.SetNull);
  332. table.ForeignKey(
  333. name: "FK_Post_Board_BoardID",
  334. column: x => x.BoardID,
  335. principalTable: "Board",
  336. principalColumn: "ID",
  337. onDelete: ReferentialAction.Restrict);
  338. table.ForeignKey(
  339. name: "FK_Post_Member_MemberID",
  340. column: x => x.MemberID,
  341. principalTable: "Member",
  342. principalColumn: "ID",
  343. onDelete: ReferentialAction.Restrict);
  344. },
  345. comment: "게시글");
  346. migrationBuilder.CreateTable(
  347. name: "Comment",
  348. columns: table => new
  349. {
  350. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  351. .Annotation("SqlServer:Identity", "1, 1"),
  352. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  353. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
  354. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  355. ParentID = table.Column<int>(type: "int", nullable: true, comment: "부모 댓글 ID"),
  356. MentionMemberID = table.Column<int>(type: "int", nullable: true, comment: "언급 대상 회원 ID"),
  357. Depth = table.Column<short>(type: "smallint", nullable: false, comment: "댓글 깊이"),
  358. Content = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: false, comment: "댓글 내용"),
  359. SID = table.Column<string>(type: "nvarchar(max)", nullable: false),
  360. Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
  361. Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
  362. IsReply = table.Column<bool>(type: "bit", nullable: false),
  363. IsSecret = table.Column<bool>(type: "bit", nullable: false),
  364. IsDeleted = table.Column<bool>(type: "bit", nullable: false, comment: "삭제 여부"),
  365. Likes = table.Column<int>(type: "int", nullable: false),
  366. Dislikes = table.Column<int>(type: "int", nullable: false),
  367. Reports = table.Column<int>(type: "int", nullable: false),
  368. Replies = table.Column<int>(type: "int", nullable: false),
  369. Score = table.Column<int>(type: "int", nullable: false, comment: "점수"),
  370. Images = table.Column<int>(type: "int", nullable: false),
  371. Medias = table.Column<byte>(type: "tinyint", nullable: false),
  372. Files = table.Column<byte>(type: "tinyint", nullable: false),
  373. IpAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
  374. UserAgent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  375. Status = table.Column<byte>(type: "tinyint", nullable: false, comment: "댓글 상태"),
  376. DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  377. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  378. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  379. },
  380. constraints: table =>
  381. {
  382. table.PrimaryKey("PK_Comment", x => x.ID);
  383. table.ForeignKey(
  384. name: "FK_Comment_Board_BoardID",
  385. column: x => x.BoardID,
  386. principalTable: "Board",
  387. principalColumn: "ID",
  388. onDelete: ReferentialAction.Restrict);
  389. table.ForeignKey(
  390. name: "FK_Comment_Comment_ParentID",
  391. column: x => x.ParentID,
  392. principalTable: "Comment",
  393. principalColumn: "ID",
  394. onDelete: ReferentialAction.Restrict);
  395. table.ForeignKey(
  396. name: "FK_Comment_Member_MemberID",
  397. column: x => x.MemberID,
  398. principalTable: "Member",
  399. principalColumn: "ID",
  400. onDelete: ReferentialAction.Restrict);
  401. table.ForeignKey(
  402. name: "FK_Comment_Member_MentionMemberID",
  403. column: x => x.MentionMemberID,
  404. principalTable: "Member",
  405. principalColumn: "ID",
  406. onDelete: ReferentialAction.SetNull);
  407. table.ForeignKey(
  408. name: "FK_Comment_Post_PostID",
  409. column: x => x.PostID,
  410. principalTable: "Post",
  411. principalColumn: "ID",
  412. onDelete: ReferentialAction.Cascade);
  413. },
  414. comment: "댓글");
  415. migrationBuilder.CreateTable(
  416. name: "PostBookmark",
  417. columns: table => new
  418. {
  419. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  420. .Annotation("SqlServer:Identity", "1, 1"),
  421. BoardID = table.Column<int>(type: "int", nullable: false),
  422. PostID = table.Column<int>(type: "int", nullable: false),
  423. MemberID = table.Column<int>(type: "int", nullable: false),
  424. IpAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
  425. UserAgent = table.Column<string>(type: "nvarchar(max)", nullable: true),
  426. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  427. },
  428. constraints: table =>
  429. {
  430. table.PrimaryKey("PK_PostBookmark", x => x.ID);
  431. table.ForeignKey(
  432. name: "FK_PostBookmark_Board_BoardID",
  433. column: x => x.BoardID,
  434. principalTable: "Board",
  435. principalColumn: "ID",
  436. onDelete: ReferentialAction.Restrict);
  437. table.ForeignKey(
  438. name: "FK_PostBookmark_Member_MemberID",
  439. column: x => x.MemberID,
  440. principalTable: "Member",
  441. principalColumn: "ID",
  442. onDelete: ReferentialAction.Cascade);
  443. table.ForeignKey(
  444. name: "FK_PostBookmark_Post_PostID",
  445. column: x => x.PostID,
  446. principalTable: "Post",
  447. principalColumn: "ID",
  448. onDelete: ReferentialAction.Cascade);
  449. },
  450. comment: "게시글 즐겨찾기");
  451. migrationBuilder.CreateTable(
  452. name: "PostFile",
  453. columns: table => new
  454. {
  455. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  456. .Annotation("SqlServer:Identity", "1, 1"),
  457. BoardID = table.Column<int>(type: "int", nullable: false),
  458. PostID = table.Column<int>(type: "int", nullable: false),
  459. UUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  460. FileName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  461. HashedName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  462. Path = table.Column<string>(type: "nvarchar(max)", nullable: false),
  463. Url = table.Column<string>(type: "nvarchar(max)", nullable: false),
  464. Extension = table.Column<string>(type: "nvarchar(max)", nullable: true),
  465. ContentType = table.Column<string>(type: "nvarchar(max)", nullable: true),
  466. Size = table.Column<long>(type: "bigint", nullable: true),
  467. Downloads = table.Column<int>(type: "int", nullable: false),
  468. IsDisabled = table.Column<bool>(type: "bit", nullable: false),
  469. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  470. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  471. },
  472. constraints: table =>
  473. {
  474. table.PrimaryKey("PK_PostFile", x => x.ID);
  475. table.ForeignKey(
  476. name: "FK_PostFile_Board_BoardID",
  477. column: x => x.BoardID,
  478. principalTable: "Board",
  479. principalColumn: "ID",
  480. onDelete: ReferentialAction.Restrict);
  481. table.ForeignKey(
  482. name: "FK_PostFile_Post_PostID",
  483. column: x => x.PostID,
  484. principalTable: "Post",
  485. principalColumn: "ID",
  486. onDelete: ReferentialAction.Cascade);
  487. },
  488. comment: "게시글 파일");
  489. migrationBuilder.CreateTable(
  490. name: "PostImage",
  491. columns: table => new
  492. {
  493. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  494. .Annotation("SqlServer:Identity", "1, 1"),
  495. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  496. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
  497. UUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "이미지 ID"),
  498. FileName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "원본 파일명"),
  499. HashedName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "저장 파일명"),
  500. Path = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false, comment: "저장 경로"),
  501. Url = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "URL"),
  502. Extension = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true, comment: "확장자"),
  503. ContentType = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "MIME 타입"),
  504. Size = table.Column<long>(type: "bigint", nullable: true, comment: "용량(byte)"),
  505. Width = table.Column<short>(type: "smallint", nullable: true, comment: "가로 해상도(px)"),
  506. Height = table.Column<short>(type: "smallint", nullable: true, comment: "세로 해상도(px)"),
  507. IsDisabled = table.Column<bool>(type: "bit", nullable: false, comment: "비활성 여부"),
  508. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "비활성 일시"),
  509. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  510. },
  511. constraints: table =>
  512. {
  513. table.PrimaryKey("PK_PostImage", x => x.ID);
  514. table.ForeignKey(
  515. name: "FK_PostImage_Board_BoardID",
  516. column: x => x.BoardID,
  517. principalTable: "Board",
  518. principalColumn: "ID",
  519. onDelete: ReferentialAction.Restrict);
  520. table.ForeignKey(
  521. name: "FK_PostImage_Post_PostID",
  522. column: x => x.PostID,
  523. principalTable: "Post",
  524. principalColumn: "ID",
  525. onDelete: ReferentialAction.Cascade);
  526. },
  527. comment: "게시글 이미지");
  528. migrationBuilder.CreateTable(
  529. name: "PostLink",
  530. columns: table => new
  531. {
  532. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  533. .Annotation("SqlServer:Identity", "1, 1"),
  534. BoardID = table.Column<int>(type: "int", nullable: false),
  535. PostID = table.Column<int>(type: "int", nullable: false),
  536. UUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  537. Url = table.Column<string>(type: "nvarchar(max)", nullable: false),
  538. Clicks = table.Column<int>(type: "int", nullable: false),
  539. IsDisabled = table.Column<bool>(type: "bit", nullable: false),
  540. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  541. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  542. },
  543. constraints: table =>
  544. {
  545. table.PrimaryKey("PK_PostLink", x => x.ID);
  546. table.ForeignKey(
  547. name: "FK_PostLink_Board_BoardID",
  548. column: x => x.BoardID,
  549. principalTable: "Board",
  550. principalColumn: "ID",
  551. onDelete: ReferentialAction.Restrict);
  552. table.ForeignKey(
  553. name: "FK_PostLink_Post_PostID",
  554. column: x => x.PostID,
  555. principalTable: "Post",
  556. principalColumn: "ID",
  557. onDelete: ReferentialAction.Cascade);
  558. },
  559. comment: "게시글 링크");
  560. migrationBuilder.CreateTable(
  561. name: "PostMedia",
  562. columns: table => new
  563. {
  564. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  565. .Annotation("SqlServer:Identity", "1, 1"),
  566. BoardID = table.Column<int>(type: "int", nullable: false),
  567. PostID = table.Column<int>(type: "int", nullable: false),
  568. Url = table.Column<string>(type: "nvarchar(max)", nullable: false),
  569. IsDisabled = table.Column<bool>(type: "bit", nullable: false),
  570. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  571. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  572. },
  573. constraints: table =>
  574. {
  575. table.PrimaryKey("PK_PostMedia", x => x.ID);
  576. table.ForeignKey(
  577. name: "FK_PostMedia_Board_BoardID",
  578. column: x => x.BoardID,
  579. principalTable: "Board",
  580. principalColumn: "ID",
  581. onDelete: ReferentialAction.Restrict);
  582. table.ForeignKey(
  583. name: "FK_PostMedia_Post_PostID",
  584. column: x => x.PostID,
  585. principalTable: "Post",
  586. principalColumn: "ID",
  587. onDelete: ReferentialAction.Cascade);
  588. },
  589. comment: "게시글 미디어");
  590. migrationBuilder.CreateTable(
  591. name: "PostReaction",
  592. columns: table => new
  593. {
  594. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  595. .Annotation("SqlServer:Identity", "1, 1"),
  596. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  597. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
  598. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  599. Reaction = table.Column<byte>(type: "tinyint", nullable: false, comment: "반응 구분"),
  600. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  601. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-agent"),
  602. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  603. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  604. },
  605. constraints: table =>
  606. {
  607. table.PrimaryKey("PK_PostReaction", x => x.ID);
  608. table.ForeignKey(
  609. name: "FK_PostReaction_Board_BoardID",
  610. column: x => x.BoardID,
  611. principalTable: "Board",
  612. principalColumn: "ID",
  613. onDelete: ReferentialAction.Restrict);
  614. table.ForeignKey(
  615. name: "FK_PostReaction_Member_MemberID",
  616. column: x => x.MemberID,
  617. principalTable: "Member",
  618. principalColumn: "ID",
  619. onDelete: ReferentialAction.Cascade);
  620. table.ForeignKey(
  621. name: "FK_PostReaction_Post_PostID",
  622. column: x => x.PostID,
  623. principalTable: "Post",
  624. principalColumn: "ID",
  625. onDelete: ReferentialAction.Cascade);
  626. },
  627. comment: "게시글 반응");
  628. migrationBuilder.CreateTable(
  629. name: "PostReport",
  630. columns: table => new
  631. {
  632. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  633. .Annotation("SqlServer:Identity", "1, 1"),
  634. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  635. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
  636. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  637. Type = table.Column<byte>(type: "tinyint", nullable: false, comment: "신고 사유"),
  638. Reason = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "신고 내용"),
  639. Status = table.Column<byte>(type: "tinyint", nullable: false, comment: "처리 상태"),
  640. Memo = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "처리 내용"),
  641. IpAddress = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "IP Address"),
  642. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-agent"),
  643. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  644. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  645. },
  646. constraints: table =>
  647. {
  648. table.PrimaryKey("PK_PostReport", x => x.ID);
  649. table.ForeignKey(
  650. name: "FK_PostReport_Board_BoardID",
  651. column: x => x.BoardID,
  652. principalTable: "Board",
  653. principalColumn: "ID",
  654. onDelete: ReferentialAction.Restrict);
  655. table.ForeignKey(
  656. name: "FK_PostReport_Member_MemberID",
  657. column: x => x.MemberID,
  658. principalTable: "Member",
  659. principalColumn: "ID",
  660. onDelete: ReferentialAction.Cascade);
  661. table.ForeignKey(
  662. name: "FK_PostReport_Post_PostID",
  663. column: x => x.PostID,
  664. principalTable: "Post",
  665. principalColumn: "ID",
  666. onDelete: ReferentialAction.Cascade);
  667. },
  668. comment: "게시글 신고");
  669. migrationBuilder.CreateTable(
  670. name: "PostTag",
  671. columns: table => new
  672. {
  673. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  674. .Annotation("SqlServer:Identity", "1, 1"),
  675. BoardID = table.Column<int>(type: "int", nullable: false),
  676. PostID = table.Column<int>(type: "int", nullable: false),
  677. TagID = table.Column<int>(type: "int", nullable: false),
  678. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  679. },
  680. constraints: table =>
  681. {
  682. table.PrimaryKey("PK_PostTag", x => x.ID);
  683. table.ForeignKey(
  684. name: "FK_PostTag_Board_BoardID",
  685. column: x => x.BoardID,
  686. principalTable: "Board",
  687. principalColumn: "ID",
  688. onDelete: ReferentialAction.Restrict);
  689. table.ForeignKey(
  690. name: "FK_PostTag_Post_PostID",
  691. column: x => x.PostID,
  692. principalTable: "Post",
  693. principalColumn: "ID",
  694. onDelete: ReferentialAction.Cascade);
  695. table.ForeignKey(
  696. name: "FK_PostTag_Tag_TagID",
  697. column: x => x.TagID,
  698. principalTable: "Tag",
  699. principalColumn: "ID",
  700. onDelete: ReferentialAction.Cascade);
  701. },
  702. comment: "게시글 태그 연결");
  703. migrationBuilder.CreateTable(
  704. name: "PostUpdateLog",
  705. columns: table => new
  706. {
  707. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  708. .Annotation("SqlServer:Identity", "1, 1"),
  709. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  710. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  711. SubjectDiff = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true, comment: "변경 제목"),
  712. ContentDiff = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true, comment: "변경 내용"),
  713. Note = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "비고"),
  714. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  715. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-Agent"),
  716. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  717. },
  718. constraints: table =>
  719. {
  720. table.PrimaryKey("PK_PostUpdateLog", x => x.ID);
  721. table.ForeignKey(
  722. name: "FK_PostUpdateLog_Member_MemberID",
  723. column: x => x.MemberID,
  724. principalTable: "Member",
  725. principalColumn: "ID",
  726. onDelete: ReferentialAction.Cascade);
  727. table.ForeignKey(
  728. name: "FK_PostUpdateLog_Post_PostID",
  729. column: x => x.PostID,
  730. principalTable: "Post",
  731. principalColumn: "ID",
  732. onDelete: ReferentialAction.Cascade);
  733. },
  734. comment: "게시글 수정 로그");
  735. migrationBuilder.CreateTable(
  736. name: "CommentFile",
  737. columns: table => new
  738. {
  739. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  740. .Annotation("SqlServer:Identity", "1, 1"),
  741. BoardID = table.Column<int>(type: "int", nullable: false),
  742. PostID = table.Column<int>(type: "int", nullable: false),
  743. CommentID = table.Column<int>(type: "int", nullable: false),
  744. UUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  745. FileName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  746. HashedName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  747. Path = table.Column<string>(type: "nvarchar(max)", nullable: false),
  748. Url = table.Column<string>(type: "nvarchar(max)", nullable: false),
  749. Extension = table.Column<string>(type: "nvarchar(max)", nullable: true),
  750. ContentType = table.Column<string>(type: "nvarchar(max)", nullable: true),
  751. Size = table.Column<long>(type: "bigint", nullable: true),
  752. Downloads = table.Column<int>(type: "int", nullable: false),
  753. IsDisabled = table.Column<bool>(type: "bit", nullable: false),
  754. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  755. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  756. },
  757. constraints: table =>
  758. {
  759. table.PrimaryKey("PK_CommentFile", x => x.ID);
  760. table.ForeignKey(
  761. name: "FK_CommentFile_Board_BoardID",
  762. column: x => x.BoardID,
  763. principalTable: "Board",
  764. principalColumn: "ID",
  765. onDelete: ReferentialAction.Restrict);
  766. table.ForeignKey(
  767. name: "FK_CommentFile_Comment_CommentID",
  768. column: x => x.CommentID,
  769. principalTable: "Comment",
  770. principalColumn: "ID",
  771. onDelete: ReferentialAction.Cascade);
  772. table.ForeignKey(
  773. name: "FK_CommentFile_Post_PostID",
  774. column: x => x.PostID,
  775. principalTable: "Post",
  776. principalColumn: "ID",
  777. onDelete: ReferentialAction.Restrict);
  778. },
  779. comment: "댓글 파일");
  780. migrationBuilder.CreateTable(
  781. name: "CommentImage",
  782. columns: table => new
  783. {
  784. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  785. .Annotation("SqlServer:Identity", "1, 1"),
  786. BoardID = table.Column<int>(type: "int", nullable: false),
  787. PostID = table.Column<int>(type: "int", nullable: false),
  788. CommentID = table.Column<int>(type: "int", nullable: false),
  789. UUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  790. FileName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  791. HashedName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  792. Path = table.Column<string>(type: "nvarchar(max)", nullable: false),
  793. Url = table.Column<string>(type: "nvarchar(max)", nullable: false),
  794. Extension = table.Column<string>(type: "nvarchar(max)", nullable: true),
  795. ContentType = table.Column<string>(type: "nvarchar(max)", nullable: true),
  796. Size = table.Column<long>(type: "bigint", nullable: true),
  797. Width = table.Column<short>(type: "smallint", nullable: true),
  798. Height = table.Column<short>(type: "smallint", nullable: true),
  799. IsDisabled = table.Column<bool>(type: "bit", nullable: false),
  800. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  801. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  802. },
  803. constraints: table =>
  804. {
  805. table.PrimaryKey("PK_CommentImage", x => x.ID);
  806. table.ForeignKey(
  807. name: "FK_CommentImage_Board_BoardID",
  808. column: x => x.BoardID,
  809. principalTable: "Board",
  810. principalColumn: "ID",
  811. onDelete: ReferentialAction.Restrict);
  812. table.ForeignKey(
  813. name: "FK_CommentImage_Comment_CommentID",
  814. column: x => x.CommentID,
  815. principalTable: "Comment",
  816. principalColumn: "ID",
  817. onDelete: ReferentialAction.Cascade);
  818. table.ForeignKey(
  819. name: "FK_CommentImage_Post_PostID",
  820. column: x => x.PostID,
  821. principalTable: "Post",
  822. principalColumn: "ID",
  823. onDelete: ReferentialAction.Restrict);
  824. },
  825. comment: "댓글 이미지");
  826. migrationBuilder.CreateTable(
  827. name: "CommentLink",
  828. columns: table => new
  829. {
  830. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  831. .Annotation("SqlServer:Identity", "1, 1"),
  832. BoardID = table.Column<int>(type: "int", nullable: false),
  833. PostID = table.Column<int>(type: "int", nullable: false),
  834. CommentID = table.Column<int>(type: "int", nullable: false),
  835. UUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  836. Url = table.Column<string>(type: "nvarchar(max)", nullable: false),
  837. Clicks = table.Column<int>(type: "int", nullable: false),
  838. IsDisabled = table.Column<bool>(type: "bit", nullable: false),
  839. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  840. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  841. },
  842. constraints: table =>
  843. {
  844. table.PrimaryKey("PK_CommentLink", x => x.ID);
  845. table.ForeignKey(
  846. name: "FK_CommentLink_Board_BoardID",
  847. column: x => x.BoardID,
  848. principalTable: "Board",
  849. principalColumn: "ID",
  850. onDelete: ReferentialAction.Restrict);
  851. table.ForeignKey(
  852. name: "FK_CommentLink_Comment_CommentID",
  853. column: x => x.CommentID,
  854. principalTable: "Comment",
  855. principalColumn: "ID",
  856. onDelete: ReferentialAction.Cascade);
  857. table.ForeignKey(
  858. name: "FK_CommentLink_Post_PostID",
  859. column: x => x.PostID,
  860. principalTable: "Post",
  861. principalColumn: "ID",
  862. onDelete: ReferentialAction.Restrict);
  863. },
  864. comment: "댓글 링크");
  865. migrationBuilder.CreateTable(
  866. name: "CommentMedia",
  867. columns: table => new
  868. {
  869. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  870. .Annotation("SqlServer:Identity", "1, 1"),
  871. BoardID = table.Column<int>(type: "int", nullable: false),
  872. PostID = table.Column<int>(type: "int", nullable: false),
  873. CommentID = table.Column<int>(type: "int", nullable: false),
  874. Url = table.Column<string>(type: "nvarchar(max)", nullable: false),
  875. IsDisabled = table.Column<bool>(type: "bit", nullable: false),
  876. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  877. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  878. },
  879. constraints: table =>
  880. {
  881. table.PrimaryKey("PK_CommentMedia", x => x.ID);
  882. table.ForeignKey(
  883. name: "FK_CommentMedia_Board_BoardID",
  884. column: x => x.BoardID,
  885. principalTable: "Board",
  886. principalColumn: "ID",
  887. onDelete: ReferentialAction.Restrict);
  888. table.ForeignKey(
  889. name: "FK_CommentMedia_Comment_CommentID",
  890. column: x => x.CommentID,
  891. principalTable: "Comment",
  892. principalColumn: "ID",
  893. onDelete: ReferentialAction.Cascade);
  894. table.ForeignKey(
  895. name: "FK_CommentMedia_Post_PostID",
  896. column: x => x.PostID,
  897. principalTable: "Post",
  898. principalColumn: "ID",
  899. onDelete: ReferentialAction.Restrict);
  900. },
  901. comment: "댓글 미디어");
  902. migrationBuilder.CreateTable(
  903. name: "CommentMention",
  904. columns: table => new
  905. {
  906. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  907. .Annotation("SqlServer:Identity", "1, 1"),
  908. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  909. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
  910. CommentID = table.Column<int>(type: "int", nullable: false, comment: "댓글 ID"),
  911. MemberID = table.Column<int>(type: "int", nullable: false, comment: "언급된 회원 ID"),
  912. RawHandle = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false, comment: "원문 회원 언급값"),
  913. Start = table.Column<int>(type: "int", nullable: false, comment: "본문 내 시작 인덱스"),
  914. Length = table.Column<int>(type: "int", nullable: false, comment: "길이"),
  915. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  916. },
  917. constraints: table =>
  918. {
  919. table.PrimaryKey("PK_CommentMention", x => x.ID);
  920. table.ForeignKey(
  921. name: "FK_CommentMention_Board_BoardID",
  922. column: x => x.BoardID,
  923. principalTable: "Board",
  924. principalColumn: "ID",
  925. onDelete: ReferentialAction.Restrict);
  926. table.ForeignKey(
  927. name: "FK_CommentMention_Comment_CommentID",
  928. column: x => x.CommentID,
  929. principalTable: "Comment",
  930. principalColumn: "ID",
  931. onDelete: ReferentialAction.Cascade);
  932. table.ForeignKey(
  933. name: "FK_CommentMention_Member_MemberID",
  934. column: x => x.MemberID,
  935. principalTable: "Member",
  936. principalColumn: "ID",
  937. onDelete: ReferentialAction.Cascade);
  938. table.ForeignKey(
  939. name: "FK_CommentMention_Post_PostID",
  940. column: x => x.PostID,
  941. principalTable: "Post",
  942. principalColumn: "ID",
  943. onDelete: ReferentialAction.Restrict);
  944. },
  945. comment: "댓글 멘션");
  946. migrationBuilder.CreateTable(
  947. name: "CommentReaction",
  948. columns: table => new
  949. {
  950. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  951. .Annotation("SqlServer:Identity", "1, 1"),
  952. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  953. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
  954. CommentID = table.Column<int>(type: "int", nullable: false, comment: "댓글 ID"),
  955. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  956. Reaction = table.Column<byte>(type: "tinyint", nullable: false, comment: "반응 구분"),
  957. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  958. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-agent"),
  959. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  960. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  961. },
  962. constraints: table =>
  963. {
  964. table.PrimaryKey("PK_CommentReaction", x => x.ID);
  965. table.ForeignKey(
  966. name: "FK_CommentReaction_Board_BoardID",
  967. column: x => x.BoardID,
  968. principalTable: "Board",
  969. principalColumn: "ID",
  970. onDelete: ReferentialAction.Restrict);
  971. table.ForeignKey(
  972. name: "FK_CommentReaction_Comment_CommentID",
  973. column: x => x.CommentID,
  974. principalTable: "Comment",
  975. principalColumn: "ID",
  976. onDelete: ReferentialAction.Cascade);
  977. table.ForeignKey(
  978. name: "FK_CommentReaction_Member_MemberID",
  979. column: x => x.MemberID,
  980. principalTable: "Member",
  981. principalColumn: "ID",
  982. onDelete: ReferentialAction.Cascade);
  983. table.ForeignKey(
  984. name: "FK_CommentReaction_Post_PostID",
  985. column: x => x.PostID,
  986. principalTable: "Post",
  987. principalColumn: "ID",
  988. onDelete: ReferentialAction.Restrict);
  989. },
  990. comment: "댓글 반응");
  991. migrationBuilder.CreateTable(
  992. name: "CommentReport",
  993. columns: table => new
  994. {
  995. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  996. .Annotation("SqlServer:Identity", "1, 1"),
  997. BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  998. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
  999. CommentID = table.Column<int>(type: "int", nullable: false, comment: "댓글 ID"),
  1000. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  1001. Type = table.Column<byte>(type: "tinyint", nullable: false, comment: "신고 사유"),
  1002. Reason = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "신고 내용"),
  1003. Status = table.Column<byte>(type: "tinyint", nullable: false, comment: "처리 상태"),
  1004. Memo = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "처리 내용"),
  1005. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  1006. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-agent"),
  1007. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  1008. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  1009. },
  1010. constraints: table =>
  1011. {
  1012. table.PrimaryKey("PK_CommentReport", x => x.ID);
  1013. table.ForeignKey(
  1014. name: "FK_CommentReport_Board_BoardID",
  1015. column: x => x.BoardID,
  1016. principalTable: "Board",
  1017. principalColumn: "ID",
  1018. onDelete: ReferentialAction.Restrict);
  1019. table.ForeignKey(
  1020. name: "FK_CommentReport_Comment_CommentID",
  1021. column: x => x.CommentID,
  1022. principalTable: "Comment",
  1023. principalColumn: "ID",
  1024. onDelete: ReferentialAction.Cascade);
  1025. table.ForeignKey(
  1026. name: "FK_CommentReport_Member_MemberID",
  1027. column: x => x.MemberID,
  1028. principalTable: "Member",
  1029. principalColumn: "ID",
  1030. onDelete: ReferentialAction.Cascade);
  1031. table.ForeignKey(
  1032. name: "FK_CommentReport_Post_PostID",
  1033. column: x => x.PostID,
  1034. principalTable: "Post",
  1035. principalColumn: "ID",
  1036. onDelete: ReferentialAction.Restrict);
  1037. },
  1038. comment: "댓글 신고");
  1039. migrationBuilder.CreateTable(
  1040. name: "CommentUpdateLog",
  1041. columns: table => new
  1042. {
  1043. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  1044. .Annotation("SqlServer:Identity", "1, 1"),
  1045. CommentID = table.Column<int>(type: "int", nullable: false, comment: "댓글 ID"),
  1046. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  1047. ContentDiff = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true, comment: "변경 내용"),
  1048. Note = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "비고"),
  1049. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  1050. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-Agent"),
  1051. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  1052. },
  1053. constraints: table =>
  1054. {
  1055. table.PrimaryKey("PK_CommentUpdateLog", x => x.ID);
  1056. table.ForeignKey(
  1057. name: "FK_CommentUpdateLog_Comment_CommentID",
  1058. column: x => x.CommentID,
  1059. principalTable: "Comment",
  1060. principalColumn: "ID",
  1061. onDelete: ReferentialAction.Cascade);
  1062. table.ForeignKey(
  1063. name: "FK_CommentUpdateLog_Member_MemberID",
  1064. column: x => x.MemberID,
  1065. principalTable: "Member",
  1066. principalColumn: "ID",
  1067. onDelete: ReferentialAction.Cascade);
  1068. },
  1069. comment: "댓글 수정 로그");
  1070. migrationBuilder.CreateTable(
  1071. name: "PostFileDownLog",
  1072. columns: table => new
  1073. {
  1074. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  1075. .Annotation("SqlServer:Identity", "1, 1"),
  1076. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
  1077. PostFileID = table.Column<int>(type: "int", nullable: false, comment: "게시글 파일 ID"),
  1078. MemberID = table.Column<int>(type: "int", nullable: true, comment: "회원 ID"),
  1079. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  1080. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-Agent"),
  1081. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  1082. },
  1083. constraints: table =>
  1084. {
  1085. table.PrimaryKey("PK_PostFileDownLog", x => x.ID);
  1086. table.ForeignKey(
  1087. name: "FK_PostFileDownLog_Member_MemberID",
  1088. column: x => x.MemberID,
  1089. principalTable: "Member",
  1090. principalColumn: "ID",
  1091. onDelete: ReferentialAction.Restrict);
  1092. table.ForeignKey(
  1093. name: "FK_PostFileDownLog_PostFile_PostFileID",
  1094. column: x => x.PostFileID,
  1095. principalTable: "PostFile",
  1096. principalColumn: "ID",
  1097. onDelete: ReferentialAction.Restrict);
  1098. table.ForeignKey(
  1099. name: "FK_PostFileDownLog_Post_PostID",
  1100. column: x => x.PostID,
  1101. principalTable: "Post",
  1102. principalColumn: "ID",
  1103. onDelete: ReferentialAction.Cascade);
  1104. },
  1105. comment: "게시글 파일 다운로드 로그");
  1106. migrationBuilder.CreateTable(
  1107. name: "PostLinkClickLog",
  1108. columns: table => new
  1109. {
  1110. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  1111. .Annotation("SqlServer:Identity", "1, 1"),
  1112. PostID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
  1113. PostLinkID = table.Column<int>(type: "int", nullable: false, comment: "게시글 파일 ID"),
  1114. MemberID = table.Column<int>(type: "int", nullable: true, comment: "회원 ID"),
  1115. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  1116. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-Agent"),
  1117. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  1118. },
  1119. constraints: table =>
  1120. {
  1121. table.PrimaryKey("PK_PostLinkClickLog", x => x.ID);
  1122. table.ForeignKey(
  1123. name: "FK_PostLinkClickLog_Member_MemberID",
  1124. column: x => x.MemberID,
  1125. principalTable: "Member",
  1126. principalColumn: "ID",
  1127. onDelete: ReferentialAction.Restrict);
  1128. table.ForeignKey(
  1129. name: "FK_PostLinkClickLog_PostLink_PostLinkID",
  1130. column: x => x.PostLinkID,
  1131. principalTable: "PostLink",
  1132. principalColumn: "ID",
  1133. onDelete: ReferentialAction.Restrict);
  1134. table.ForeignKey(
  1135. name: "FK_PostLinkClickLog_Post_PostID",
  1136. column: x => x.PostID,
  1137. principalTable: "Post",
  1138. principalColumn: "ID",
  1139. onDelete: ReferentialAction.Cascade);
  1140. },
  1141. comment: "게시글 링크 클릭 로그");
  1142. migrationBuilder.CreateTable(
  1143. name: "CommentFileDownLog",
  1144. columns: table => new
  1145. {
  1146. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  1147. .Annotation("SqlServer:Identity", "1, 1"),
  1148. CommentID = table.Column<int>(type: "int", nullable: false, comment: "댓글 ID"),
  1149. CommentFileID = table.Column<int>(type: "int", nullable: false, comment: "댓글 파일 ID"),
  1150. MemberID = table.Column<int>(type: "int", nullable: true, comment: "회원 ID"),
  1151. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  1152. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-Agent"),
  1153. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  1154. },
  1155. constraints: table =>
  1156. {
  1157. table.PrimaryKey("PK_CommentFileDownLog", x => x.ID);
  1158. table.ForeignKey(
  1159. name: "FK_CommentFileDownLog_CommentFile_CommentFileID",
  1160. column: x => x.CommentFileID,
  1161. principalTable: "CommentFile",
  1162. principalColumn: "ID",
  1163. onDelete: ReferentialAction.Restrict);
  1164. table.ForeignKey(
  1165. name: "FK_CommentFileDownLog_Comment_CommentID",
  1166. column: x => x.CommentID,
  1167. principalTable: "Comment",
  1168. principalColumn: "ID",
  1169. onDelete: ReferentialAction.Cascade);
  1170. table.ForeignKey(
  1171. name: "FK_CommentFileDownLog_Member_MemberID",
  1172. column: x => x.MemberID,
  1173. principalTable: "Member",
  1174. principalColumn: "ID",
  1175. onDelete: ReferentialAction.Restrict);
  1176. },
  1177. comment: "댓글 파일 다운로드 로그");
  1178. migrationBuilder.CreateTable(
  1179. name: "CommentLinkClickLog",
  1180. columns: table => new
  1181. {
  1182. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  1183. .Annotation("SqlServer:Identity", "1, 1"),
  1184. CommentID = table.Column<int>(type: "int", nullable: false, comment: "댓글 ID"),
  1185. CommentLinkID = table.Column<int>(type: "int", nullable: false, comment: "댓글 링크 ID"),
  1186. MemberID = table.Column<int>(type: "int", nullable: true, comment: "회원 ID"),
  1187. IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "IP Address"),
  1188. UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-Agent"),
  1189. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  1190. },
  1191. constraints: table =>
  1192. {
  1193. table.PrimaryKey("PK_CommentLinkClickLog", x => x.ID);
  1194. table.ForeignKey(
  1195. name: "FK_CommentLinkClickLog_CommentLink_CommentLinkID",
  1196. column: x => x.CommentLinkID,
  1197. principalTable: "CommentLink",
  1198. principalColumn: "ID",
  1199. onDelete: ReferentialAction.Restrict);
  1200. table.ForeignKey(
  1201. name: "FK_CommentLinkClickLog_Comment_CommentID",
  1202. column: x => x.CommentID,
  1203. principalTable: "Comment",
  1204. principalColumn: "ID",
  1205. onDelete: ReferentialAction.Cascade);
  1206. table.ForeignKey(
  1207. name: "FK_CommentLinkClickLog_Member_MemberID",
  1208. column: x => x.MemberID,
  1209. principalTable: "Member",
  1210. principalColumn: "ID",
  1211. onDelete: ReferentialAction.Restrict);
  1212. },
  1213. comment: "댓글 링크 클릭 로그");
  1214. migrationBuilder.CreateIndex(
  1215. name: "IX_Board_BoardGroupID",
  1216. table: "Board",
  1217. column: "BoardGroupID");
  1218. migrationBuilder.CreateIndex(
  1219. name: "IX_Board_Code",
  1220. table: "Board",
  1221. column: "Code",
  1222. unique: true);
  1223. migrationBuilder.CreateIndex(
  1224. name: "IX_Board_Code_IsActive",
  1225. table: "Board",
  1226. columns: new[] { "Code", "IsActive" });
  1227. migrationBuilder.CreateIndex(
  1228. name: "IX_Board_Code_IsSearch",
  1229. table: "Board",
  1230. columns: new[] { "Code", "IsSearch" });
  1231. migrationBuilder.CreateIndex(
  1232. name: "IX_Board_Comments",
  1233. table: "Board",
  1234. column: "Comments");
  1235. migrationBuilder.CreateIndex(
  1236. name: "IX_Board_IsActive",
  1237. table: "Board",
  1238. column: "IsActive");
  1239. migrationBuilder.CreateIndex(
  1240. name: "IX_Board_IsSearch",
  1241. table: "Board",
  1242. column: "IsSearch");
  1243. migrationBuilder.CreateIndex(
  1244. name: "IX_Board_IsSearch_IsActive",
  1245. table: "Board",
  1246. columns: new[] { "IsSearch", "IsActive" });
  1247. migrationBuilder.CreateIndex(
  1248. name: "IX_Board_Name",
  1249. table: "Board",
  1250. column: "Name");
  1251. migrationBuilder.CreateIndex(
  1252. name: "IX_Board_Order",
  1253. table: "Board",
  1254. column: "Order");
  1255. migrationBuilder.CreateIndex(
  1256. name: "IX_Board_Posts",
  1257. table: "Board",
  1258. column: "Posts");
  1259. migrationBuilder.CreateIndex(
  1260. name: "IX_BoardGroup_Code",
  1261. table: "BoardGroup",
  1262. column: "Code",
  1263. unique: true);
  1264. migrationBuilder.CreateIndex(
  1265. name: "IX_BoardGroup_Code_Order_CreatedAt",
  1266. table: "BoardGroup",
  1267. columns: new[] { "Code", "Order", "CreatedAt" });
  1268. migrationBuilder.CreateIndex(
  1269. name: "IX_BoardGroup_Order",
  1270. table: "BoardGroup",
  1271. column: "Order");
  1272. migrationBuilder.CreateIndex(
  1273. name: "IX_BoardGroup_Order_CreatedAt",
  1274. table: "BoardGroup",
  1275. columns: new[] { "Order", "CreatedAt" });
  1276. migrationBuilder.CreateIndex(
  1277. name: "IX_BoardManager_BoardID",
  1278. table: "BoardManager",
  1279. column: "BoardID");
  1280. migrationBuilder.CreateIndex(
  1281. name: "IX_BoardManager_BoardID_MemberID",
  1282. table: "BoardManager",
  1283. columns: new[] { "BoardID", "MemberID" });
  1284. migrationBuilder.CreateIndex(
  1285. name: "IX_BoardManager_MemberID",
  1286. table: "BoardManager",
  1287. column: "MemberID");
  1288. migrationBuilder.CreateIndex(
  1289. name: "IX_BoardMeta_BoardID",
  1290. table: "BoardMeta",
  1291. column: "BoardID",
  1292. unique: true);
  1293. migrationBuilder.CreateIndex(
  1294. name: "IX_BoardPrefix_BoardID_IsActive_Order_CreatedAt",
  1295. table: "BoardPrefix",
  1296. columns: new[] { "BoardID", "IsActive", "Order", "CreatedAt" });
  1297. migrationBuilder.CreateIndex(
  1298. name: "IX_Comment_BoardID",
  1299. table: "Comment",
  1300. column: "BoardID");
  1301. migrationBuilder.CreateIndex(
  1302. name: "IX_Comment_MemberID",
  1303. table: "Comment",
  1304. column: "MemberID");
  1305. migrationBuilder.CreateIndex(
  1306. name: "IX_Comment_MentionMemberID",
  1307. table: "Comment",
  1308. column: "MentionMemberID");
  1309. migrationBuilder.CreateIndex(
  1310. name: "IX_Comment_ParentID",
  1311. table: "Comment",
  1312. column: "ParentID");
  1313. migrationBuilder.CreateIndex(
  1314. name: "IX_Comment_PostID",
  1315. table: "Comment",
  1316. column: "PostID");
  1317. migrationBuilder.CreateIndex(
  1318. name: "IX_Comment_PostID_IsDeleted_ParentID_CreatedAt",
  1319. table: "Comment",
  1320. columns: new[] { "PostID", "IsDeleted", "ParentID", "CreatedAt" },
  1321. descending: new[] { false, false, false, true });
  1322. migrationBuilder.CreateIndex(
  1323. name: "IX_Comment_PostID_IsDeleted_ParentID_Score_ID",
  1324. table: "Comment",
  1325. columns: new[] { "PostID", "IsDeleted", "ParentID", "Score", "ID" },
  1326. descending: new[] { false, false, false, true, true });
  1327. migrationBuilder.CreateIndex(
  1328. name: "IX_Comment_PostID_MemberID_IsDeleted_ParentID_CreatedAt",
  1329. table: "Comment",
  1330. columns: new[] { "PostID", "MemberID", "IsDeleted", "ParentID", "CreatedAt" },
  1331. descending: new[] { false, false, false, false, true });
  1332. migrationBuilder.CreateIndex(
  1333. name: "IX_Comment_PostID_MemberID_IsDeleted_ParentID_Score_ID",
  1334. table: "Comment",
  1335. columns: new[] { "PostID", "MemberID", "IsDeleted", "ParentID", "Score", "ID" },
  1336. descending: new[] { false, false, false, false, true, true });
  1337. migrationBuilder.CreateIndex(
  1338. name: "IX_CommentFile_BoardID",
  1339. table: "CommentFile",
  1340. column: "BoardID");
  1341. migrationBuilder.CreateIndex(
  1342. name: "IX_CommentFile_CommentID",
  1343. table: "CommentFile",
  1344. column: "CommentID");
  1345. migrationBuilder.CreateIndex(
  1346. name: "IX_CommentFile_PostID",
  1347. table: "CommentFile",
  1348. column: "PostID");
  1349. migrationBuilder.CreateIndex(
  1350. name: "IX_CommentFile_UUID",
  1351. table: "CommentFile",
  1352. column: "UUID",
  1353. unique: true);
  1354. migrationBuilder.CreateIndex(
  1355. name: "IX_CommentFileDownLog_CommentFileID",
  1356. table: "CommentFileDownLog",
  1357. column: "CommentFileID");
  1358. migrationBuilder.CreateIndex(
  1359. name: "IX_CommentFileDownLog_CommentID",
  1360. table: "CommentFileDownLog",
  1361. column: "CommentID");
  1362. migrationBuilder.CreateIndex(
  1363. name: "IX_CommentFileDownLog_CommentID_CommentFileID",
  1364. table: "CommentFileDownLog",
  1365. columns: new[] { "CommentID", "CommentFileID" });
  1366. migrationBuilder.CreateIndex(
  1367. name: "IX_CommentFileDownLog_CommentID_CommentFileID_MemberID",
  1368. table: "CommentFileDownLog",
  1369. columns: new[] { "CommentID", "CommentFileID", "MemberID" });
  1370. migrationBuilder.CreateIndex(
  1371. name: "IX_CommentFileDownLog_MemberID",
  1372. table: "CommentFileDownLog",
  1373. column: "MemberID");
  1374. migrationBuilder.CreateIndex(
  1375. name: "IX_CommentImage_BoardID",
  1376. table: "CommentImage",
  1377. column: "BoardID");
  1378. migrationBuilder.CreateIndex(
  1379. name: "IX_CommentImage_CommentID",
  1380. table: "CommentImage",
  1381. column: "CommentID");
  1382. migrationBuilder.CreateIndex(
  1383. name: "IX_CommentImage_PostID",
  1384. table: "CommentImage",
  1385. column: "PostID");
  1386. migrationBuilder.CreateIndex(
  1387. name: "IX_CommentImage_UUID",
  1388. table: "CommentImage",
  1389. column: "UUID",
  1390. unique: true);
  1391. migrationBuilder.CreateIndex(
  1392. name: "IX_CommentLink_BoardID",
  1393. table: "CommentLink",
  1394. column: "BoardID");
  1395. migrationBuilder.CreateIndex(
  1396. name: "IX_CommentLink_CommentID",
  1397. table: "CommentLink",
  1398. column: "CommentID");
  1399. migrationBuilder.CreateIndex(
  1400. name: "IX_CommentLink_PostID",
  1401. table: "CommentLink",
  1402. column: "PostID");
  1403. migrationBuilder.CreateIndex(
  1404. name: "IX_CommentLinkClickLog_CommentID",
  1405. table: "CommentLinkClickLog",
  1406. column: "CommentID");
  1407. migrationBuilder.CreateIndex(
  1408. name: "IX_CommentLinkClickLog_CommentID_CommentLinkID",
  1409. table: "CommentLinkClickLog",
  1410. columns: new[] { "CommentID", "CommentLinkID" });
  1411. migrationBuilder.CreateIndex(
  1412. name: "IX_CommentLinkClickLog_CommentID_CommentLinkID_MemberID",
  1413. table: "CommentLinkClickLog",
  1414. columns: new[] { "CommentID", "CommentLinkID", "MemberID" });
  1415. migrationBuilder.CreateIndex(
  1416. name: "IX_CommentLinkClickLog_CommentLinkID",
  1417. table: "CommentLinkClickLog",
  1418. column: "CommentLinkID");
  1419. migrationBuilder.CreateIndex(
  1420. name: "IX_CommentLinkClickLog_MemberID",
  1421. table: "CommentLinkClickLog",
  1422. column: "MemberID");
  1423. migrationBuilder.CreateIndex(
  1424. name: "IX_CommentMedia_BoardID",
  1425. table: "CommentMedia",
  1426. column: "BoardID");
  1427. migrationBuilder.CreateIndex(
  1428. name: "IX_CommentMedia_CommentID",
  1429. table: "CommentMedia",
  1430. column: "CommentID");
  1431. migrationBuilder.CreateIndex(
  1432. name: "IX_CommentMedia_PostID",
  1433. table: "CommentMedia",
  1434. column: "PostID");
  1435. migrationBuilder.CreateIndex(
  1436. name: "IX_CommentMention_BoardID",
  1437. table: "CommentMention",
  1438. column: "BoardID");
  1439. migrationBuilder.CreateIndex(
  1440. name: "IX_CommentMention_CommentID",
  1441. table: "CommentMention",
  1442. column: "CommentID",
  1443. unique: true);
  1444. migrationBuilder.CreateIndex(
  1445. name: "IX_CommentMention_CommentID_ID",
  1446. table: "CommentMention",
  1447. columns: new[] { "CommentID", "ID" });
  1448. migrationBuilder.CreateIndex(
  1449. name: "IX_CommentMention_CommentID_MemberID_ID",
  1450. table: "CommentMention",
  1451. columns: new[] { "CommentID", "MemberID", "ID" });
  1452. migrationBuilder.CreateIndex(
  1453. name: "IX_CommentMention_CommentID_MemberID_Start",
  1454. table: "CommentMention",
  1455. columns: new[] { "CommentID", "MemberID", "Start" });
  1456. migrationBuilder.CreateIndex(
  1457. name: "IX_CommentMention_MemberID",
  1458. table: "CommentMention",
  1459. column: "MemberID");
  1460. migrationBuilder.CreateIndex(
  1461. name: "IX_CommentMention_PostID",
  1462. table: "CommentMention",
  1463. column: "PostID");
  1464. migrationBuilder.CreateIndex(
  1465. name: "IX_CommentReaction_BoardID",
  1466. table: "CommentReaction",
  1467. column: "BoardID");
  1468. migrationBuilder.CreateIndex(
  1469. name: "IX_CommentReaction_CommentID",
  1470. table: "CommentReaction",
  1471. column: "CommentID");
  1472. migrationBuilder.CreateIndex(
  1473. name: "IX_CommentReaction_CommentID_ID",
  1474. table: "CommentReaction",
  1475. columns: new[] { "CommentID", "ID" });
  1476. migrationBuilder.CreateIndex(
  1477. name: "IX_CommentReaction_CommentID_MemberID",
  1478. table: "CommentReaction",
  1479. columns: new[] { "CommentID", "MemberID" },
  1480. unique: true);
  1481. migrationBuilder.CreateIndex(
  1482. name: "IX_CommentReaction_CreatedAt",
  1483. table: "CommentReaction",
  1484. column: "CreatedAt");
  1485. migrationBuilder.CreateIndex(
  1486. name: "IX_CommentReaction_MemberID",
  1487. table: "CommentReaction",
  1488. column: "MemberID");
  1489. migrationBuilder.CreateIndex(
  1490. name: "IX_CommentReaction_PostID",
  1491. table: "CommentReaction",
  1492. column: "PostID");
  1493. migrationBuilder.CreateIndex(
  1494. name: "IX_CommentReaction_Reaction",
  1495. table: "CommentReaction",
  1496. column: "Reaction");
  1497. migrationBuilder.CreateIndex(
  1498. name: "IX_CommentReport_BoardID",
  1499. table: "CommentReport",
  1500. column: "BoardID");
  1501. migrationBuilder.CreateIndex(
  1502. name: "IX_CommentReport_CommentID",
  1503. table: "CommentReport",
  1504. column: "CommentID");
  1505. migrationBuilder.CreateIndex(
  1506. name: "IX_CommentReport_CommentID_ID",
  1507. table: "CommentReport",
  1508. columns: new[] { "CommentID", "ID" });
  1509. migrationBuilder.CreateIndex(
  1510. name: "IX_CommentReport_CommentID_MemberID",
  1511. table: "CommentReport",
  1512. columns: new[] { "CommentID", "MemberID" },
  1513. unique: true);
  1514. migrationBuilder.CreateIndex(
  1515. name: "IX_CommentReport_CreatedAt",
  1516. table: "CommentReport",
  1517. column: "CreatedAt");
  1518. migrationBuilder.CreateIndex(
  1519. name: "IX_CommentReport_MemberID",
  1520. table: "CommentReport",
  1521. column: "MemberID");
  1522. migrationBuilder.CreateIndex(
  1523. name: "IX_CommentReport_PostID",
  1524. table: "CommentReport",
  1525. column: "PostID");
  1526. migrationBuilder.CreateIndex(
  1527. name: "IX_CommentReport_Status",
  1528. table: "CommentReport",
  1529. column: "Status");
  1530. migrationBuilder.CreateIndex(
  1531. name: "IX_CommentReport_Type",
  1532. table: "CommentReport",
  1533. column: "Type");
  1534. migrationBuilder.CreateIndex(
  1535. name: "IX_CommentUpdateLog_CommentID",
  1536. table: "CommentUpdateLog",
  1537. column: "CommentID");
  1538. migrationBuilder.CreateIndex(
  1539. name: "IX_CommentUpdateLog_CommentID_ID",
  1540. table: "CommentUpdateLog",
  1541. columns: new[] { "CommentID", "ID" });
  1542. migrationBuilder.CreateIndex(
  1543. name: "IX_CommentUpdateLog_CommentID_MemberID",
  1544. table: "CommentUpdateLog",
  1545. columns: new[] { "CommentID", "MemberID" });
  1546. migrationBuilder.CreateIndex(
  1547. name: "IX_CommentUpdateLog_CommentID_MemberID_ID",
  1548. table: "CommentUpdateLog",
  1549. columns: new[] { "CommentID", "MemberID", "ID" });
  1550. migrationBuilder.CreateIndex(
  1551. name: "IX_CommentUpdateLog_ContentDiff",
  1552. table: "CommentUpdateLog",
  1553. column: "ContentDiff");
  1554. migrationBuilder.CreateIndex(
  1555. name: "IX_CommentUpdateLog_MemberID",
  1556. table: "CommentUpdateLog",
  1557. column: "MemberID");
  1558. migrationBuilder.CreateIndex(
  1559. name: "IX_Post_BoardID",
  1560. table: "Post",
  1561. column: "BoardID");
  1562. migrationBuilder.CreateIndex(
  1563. name: "IX_Post_BoardPrefixID",
  1564. table: "Post",
  1565. column: "BoardPrefixID");
  1566. migrationBuilder.CreateIndex(
  1567. name: "IX_Post_ID_BoardID",
  1568. table: "Post",
  1569. columns: new[] { "ID", "BoardID" });
  1570. migrationBuilder.CreateIndex(
  1571. name: "IX_Post_ID_BoardID_BoardPrefixID_IsDeleted_Comments",
  1572. table: "Post",
  1573. columns: new[] { "ID", "BoardID", "BoardPrefixID", "IsDeleted", "Comments" });
  1574. migrationBuilder.CreateIndex(
  1575. name: "IX_Post_ID_BoardID_BoardPrefixID_IsDeleted_CreatedAt",
  1576. table: "Post",
  1577. columns: new[] { "ID", "BoardID", "BoardPrefixID", "IsDeleted", "CreatedAt" });
  1578. migrationBuilder.CreateIndex(
  1579. name: "IX_Post_ID_BoardID_BoardPrefixID_IsDeleted_Likes",
  1580. table: "Post",
  1581. columns: new[] { "ID", "BoardID", "BoardPrefixID", "IsDeleted", "Likes" });
  1582. migrationBuilder.CreateIndex(
  1583. name: "IX_Post_ID_BoardID_BoardPrefixID_IsDeleted_Views",
  1584. table: "Post",
  1585. columns: new[] { "ID", "BoardID", "BoardPrefixID", "IsDeleted", "Views" });
  1586. migrationBuilder.CreateIndex(
  1587. name: "IX_Post_ID_BoardID_IsDeleted",
  1588. table: "Post",
  1589. columns: new[] { "ID", "BoardID", "IsDeleted" });
  1590. migrationBuilder.CreateIndex(
  1591. name: "IX_Post_MemberID",
  1592. table: "Post",
  1593. column: "MemberID");
  1594. migrationBuilder.CreateIndex(
  1595. name: "IX_PostBookmark_BoardID",
  1596. table: "PostBookmark",
  1597. column: "BoardID");
  1598. migrationBuilder.CreateIndex(
  1599. name: "IX_PostBookmark_MemberID",
  1600. table: "PostBookmark",
  1601. column: "MemberID");
  1602. migrationBuilder.CreateIndex(
  1603. name: "IX_PostBookmark_PostID",
  1604. table: "PostBookmark",
  1605. column: "PostID");
  1606. migrationBuilder.CreateIndex(
  1607. name: "IX_PostBookmark_PostID_MemberID",
  1608. table: "PostBookmark",
  1609. columns: new[] { "PostID", "MemberID" },
  1610. unique: true);
  1611. migrationBuilder.CreateIndex(
  1612. name: "IX_PostFile_BoardID",
  1613. table: "PostFile",
  1614. column: "BoardID");
  1615. migrationBuilder.CreateIndex(
  1616. name: "IX_PostFile_PostID",
  1617. table: "PostFile",
  1618. column: "PostID");
  1619. migrationBuilder.CreateIndex(
  1620. name: "IX_PostFile_UUID",
  1621. table: "PostFile",
  1622. column: "UUID",
  1623. unique: true);
  1624. migrationBuilder.CreateIndex(
  1625. name: "IX_PostFileDownLog_MemberID",
  1626. table: "PostFileDownLog",
  1627. column: "MemberID");
  1628. migrationBuilder.CreateIndex(
  1629. name: "IX_PostFileDownLog_PostFileID",
  1630. table: "PostFileDownLog",
  1631. column: "PostFileID");
  1632. migrationBuilder.CreateIndex(
  1633. name: "IX_PostFileDownLog_PostID",
  1634. table: "PostFileDownLog",
  1635. column: "PostID");
  1636. migrationBuilder.CreateIndex(
  1637. name: "IX_PostFileDownLog_PostID_PostFileID",
  1638. table: "PostFileDownLog",
  1639. columns: new[] { "PostID", "PostFileID" });
  1640. migrationBuilder.CreateIndex(
  1641. name: "IX_PostFileDownLog_PostID_PostFileID_MemberID",
  1642. table: "PostFileDownLog",
  1643. columns: new[] { "PostID", "PostFileID", "MemberID" });
  1644. migrationBuilder.CreateIndex(
  1645. name: "IX_PostImage_BoardID",
  1646. table: "PostImage",
  1647. column: "BoardID");
  1648. migrationBuilder.CreateIndex(
  1649. name: "IX_PostImage_PostID",
  1650. table: "PostImage",
  1651. column: "PostID");
  1652. migrationBuilder.CreateIndex(
  1653. name: "IX_PostImage_PostID_HashedName",
  1654. table: "PostImage",
  1655. columns: new[] { "PostID", "HashedName" });
  1656. migrationBuilder.CreateIndex(
  1657. name: "IX_PostImage_PostID_HashedName_IsDisabled",
  1658. table: "PostImage",
  1659. columns: new[] { "PostID", "HashedName", "IsDisabled" });
  1660. migrationBuilder.CreateIndex(
  1661. name: "IX_PostImage_UUID",
  1662. table: "PostImage",
  1663. column: "UUID",
  1664. unique: true);
  1665. migrationBuilder.CreateIndex(
  1666. name: "IX_PostLink_BoardID",
  1667. table: "PostLink",
  1668. column: "BoardID");
  1669. migrationBuilder.CreateIndex(
  1670. name: "IX_PostLink_PostID",
  1671. table: "PostLink",
  1672. column: "PostID");
  1673. migrationBuilder.CreateIndex(
  1674. name: "IX_PostLinkClickLog_MemberID",
  1675. table: "PostLinkClickLog",
  1676. column: "MemberID");
  1677. migrationBuilder.CreateIndex(
  1678. name: "IX_PostLinkClickLog_PostID",
  1679. table: "PostLinkClickLog",
  1680. column: "PostID");
  1681. migrationBuilder.CreateIndex(
  1682. name: "IX_PostLinkClickLog_PostID_PostLinkID",
  1683. table: "PostLinkClickLog",
  1684. columns: new[] { "PostID", "PostLinkID" });
  1685. migrationBuilder.CreateIndex(
  1686. name: "IX_PostLinkClickLog_PostID_PostLinkID_MemberID",
  1687. table: "PostLinkClickLog",
  1688. columns: new[] { "PostID", "PostLinkID", "MemberID" });
  1689. migrationBuilder.CreateIndex(
  1690. name: "IX_PostLinkClickLog_PostLinkID",
  1691. table: "PostLinkClickLog",
  1692. column: "PostLinkID");
  1693. migrationBuilder.CreateIndex(
  1694. name: "IX_PostMedia_BoardID",
  1695. table: "PostMedia",
  1696. column: "BoardID");
  1697. migrationBuilder.CreateIndex(
  1698. name: "IX_PostMedia_PostID",
  1699. table: "PostMedia",
  1700. column: "PostID");
  1701. migrationBuilder.CreateIndex(
  1702. name: "IX_PostReaction_BoardID",
  1703. table: "PostReaction",
  1704. column: "BoardID");
  1705. migrationBuilder.CreateIndex(
  1706. name: "IX_PostReaction_MemberID",
  1707. table: "PostReaction",
  1708. column: "MemberID");
  1709. migrationBuilder.CreateIndex(
  1710. name: "IX_PostReaction_PostID",
  1711. table: "PostReaction",
  1712. column: "PostID");
  1713. migrationBuilder.CreateIndex(
  1714. name: "IX_PostReaction_PostID_MemberID",
  1715. table: "PostReaction",
  1716. columns: new[] { "PostID", "MemberID" },
  1717. unique: true);
  1718. migrationBuilder.CreateIndex(
  1719. name: "IX_PostReaction_Reaction",
  1720. table: "PostReaction",
  1721. column: "Reaction");
  1722. migrationBuilder.CreateIndex(
  1723. name: "IX_PostReport_BoardID",
  1724. table: "PostReport",
  1725. column: "BoardID");
  1726. migrationBuilder.CreateIndex(
  1727. name: "IX_PostReport_MemberID",
  1728. table: "PostReport",
  1729. column: "MemberID");
  1730. migrationBuilder.CreateIndex(
  1731. name: "IX_PostReport_PostID",
  1732. table: "PostReport",
  1733. column: "PostID");
  1734. migrationBuilder.CreateIndex(
  1735. name: "IX_PostReport_PostID_MemberID",
  1736. table: "PostReport",
  1737. columns: new[] { "PostID", "MemberID" },
  1738. unique: true);
  1739. migrationBuilder.CreateIndex(
  1740. name: "IX_PostReport_Status",
  1741. table: "PostReport",
  1742. column: "Status");
  1743. migrationBuilder.CreateIndex(
  1744. name: "IX_PostReport_Type",
  1745. table: "PostReport",
  1746. column: "Type");
  1747. migrationBuilder.CreateIndex(
  1748. name: "IX_PostTag_BoardID",
  1749. table: "PostTag",
  1750. column: "BoardID");
  1751. migrationBuilder.CreateIndex(
  1752. name: "IX_PostTag_PostID",
  1753. table: "PostTag",
  1754. column: "PostID");
  1755. migrationBuilder.CreateIndex(
  1756. name: "IX_PostTag_TagID",
  1757. table: "PostTag",
  1758. column: "TagID");
  1759. migrationBuilder.CreateIndex(
  1760. name: "IX_PostUpdateLog_ContentDiff",
  1761. table: "PostUpdateLog",
  1762. column: "ContentDiff");
  1763. migrationBuilder.CreateIndex(
  1764. name: "IX_PostUpdateLog_MemberID",
  1765. table: "PostUpdateLog",
  1766. column: "MemberID");
  1767. migrationBuilder.CreateIndex(
  1768. name: "IX_PostUpdateLog_PostID",
  1769. table: "PostUpdateLog",
  1770. column: "PostID");
  1771. migrationBuilder.CreateIndex(
  1772. name: "IX_PostUpdateLog_PostID_ID",
  1773. table: "PostUpdateLog",
  1774. columns: new[] { "PostID", "ID" });
  1775. migrationBuilder.CreateIndex(
  1776. name: "IX_PostUpdateLog_PostID_MemberID",
  1777. table: "PostUpdateLog",
  1778. columns: new[] { "PostID", "MemberID" });
  1779. migrationBuilder.CreateIndex(
  1780. name: "IX_PostUpdateLog_PostID_MemberID_ID",
  1781. table: "PostUpdateLog",
  1782. columns: new[] { "PostID", "MemberID", "ID" });
  1783. migrationBuilder.CreateIndex(
  1784. name: "IX_PostUpdateLog_SubjectDiff",
  1785. table: "PostUpdateLog",
  1786. column: "SubjectDiff");
  1787. migrationBuilder.CreateIndex(
  1788. name: "IX_Tag_Name",
  1789. table: "Tag",
  1790. column: "Name",
  1791. unique: true);
  1792. migrationBuilder.CreateIndex(
  1793. name: "IX_Tag_Slug",
  1794. table: "Tag",
  1795. column: "Slug",
  1796. unique: true);
  1797. migrationBuilder.CreateIndex(
  1798. name: "IX_Tag_UsageCount",
  1799. table: "Tag",
  1800. column: "UsageCount");
  1801. }
  1802. /// <inheritdoc />
  1803. protected override void Down(MigrationBuilder migrationBuilder)
  1804. {
  1805. migrationBuilder.DropTable(
  1806. name: "BoardManager");
  1807. migrationBuilder.DropTable(
  1808. name: "BoardMeta");
  1809. migrationBuilder.DropTable(
  1810. name: "CommentFileDownLog");
  1811. migrationBuilder.DropTable(
  1812. name: "CommentImage");
  1813. migrationBuilder.DropTable(
  1814. name: "CommentLinkClickLog");
  1815. migrationBuilder.DropTable(
  1816. name: "CommentMedia");
  1817. migrationBuilder.DropTable(
  1818. name: "CommentMention");
  1819. migrationBuilder.DropTable(
  1820. name: "CommentReaction");
  1821. migrationBuilder.DropTable(
  1822. name: "CommentReport");
  1823. migrationBuilder.DropTable(
  1824. name: "CommentUpdateLog");
  1825. migrationBuilder.DropTable(
  1826. name: "PostBookmark");
  1827. migrationBuilder.DropTable(
  1828. name: "PostFileDownLog");
  1829. migrationBuilder.DropTable(
  1830. name: "PostImage");
  1831. migrationBuilder.DropTable(
  1832. name: "PostLinkClickLog");
  1833. migrationBuilder.DropTable(
  1834. name: "PostMedia");
  1835. migrationBuilder.DropTable(
  1836. name: "PostReaction");
  1837. migrationBuilder.DropTable(
  1838. name: "PostReport");
  1839. migrationBuilder.DropTable(
  1840. name: "PostTag");
  1841. migrationBuilder.DropTable(
  1842. name: "PostUpdateLog");
  1843. migrationBuilder.DropTable(
  1844. name: "CommentFile");
  1845. migrationBuilder.DropTable(
  1846. name: "CommentLink");
  1847. migrationBuilder.DropTable(
  1848. name: "PostFile");
  1849. migrationBuilder.DropTable(
  1850. name: "PostLink");
  1851. migrationBuilder.DropTable(
  1852. name: "Tag");
  1853. migrationBuilder.DropTable(
  1854. name: "Comment");
  1855. migrationBuilder.DropTable(
  1856. name: "Post");
  1857. migrationBuilder.DropTable(
  1858. name: "BoardPrefix");
  1859. migrationBuilder.DropTable(
  1860. name: "Board");
  1861. migrationBuilder.DropTable(
  1862. name: "BoardGroup");
  1863. }
  1864. }
  1865. }