20260208090603_AddForumEntities.cs 99 KB

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