20260617111213_AddGameDetailFields.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Persistence.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class AddGameDetailFields : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AddColumn<string>(
  13. name: "MinSpec",
  14. table: "Game",
  15. type: "nvarchar(max)",
  16. nullable: true,
  17. comment: "최소 사양 (자유 텍스트)");
  18. migrationBuilder.AddColumn<string>(
  19. name: "RecommendedSpec",
  20. table: "Game",
  21. type: "nvarchar(max)",
  22. nullable: true,
  23. comment: "권장 사양 (자유 텍스트)");
  24. migrationBuilder.AddColumn<string>(
  25. name: "TrailerUrl",
  26. table: "Game",
  27. type: "nvarchar(500)",
  28. maxLength: 500,
  29. nullable: true,
  30. comment: "YouTube 예고편 URL");
  31. migrationBuilder.CreateTable(
  32. name: "GameCategory",
  33. columns: table => new
  34. {
  35. ID = table.Column<int>(type: "int", nullable: false)
  36. .Annotation("SqlServer:Identity", "1, 1"),
  37. KorName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "카테고리 한글명"),
  38. EngName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "카테고리 영문명"),
  39. Order = table.Column<int>(type: "int", nullable: false),
  40. IsActive = table.Column<bool>(type: "bit", nullable: false),
  41. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  42. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  43. },
  44. constraints: table =>
  45. {
  46. table.PrimaryKey("PK_GameCategory", x => x.ID);
  47. },
  48. comment: "게임 카테고리 코드");
  49. migrationBuilder.CreateTable(
  50. name: "GameGenre",
  51. columns: table => new
  52. {
  53. ID = table.Column<int>(type: "int", nullable: false)
  54. .Annotation("SqlServer:Identity", "1, 1"),
  55. KorName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "장르 한글명"),
  56. EngName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "장르 영문명"),
  57. Order = table.Column<int>(type: "int", nullable: false),
  58. IsActive = table.Column<bool>(type: "bit", nullable: false),
  59. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  60. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  61. },
  62. constraints: table =>
  63. {
  64. table.PrimaryKey("PK_GameGenre", x => x.ID);
  65. },
  66. comment: "게임 장르 코드");
  67. migrationBuilder.CreateTable(
  68. name: "GameImage",
  69. columns: table => new
  70. {
  71. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  72. .Annotation("SqlServer:Identity", "1, 1"),
  73. GameID = table.Column<int>(type: "int", nullable: false),
  74. UUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "UUID"),
  75. FileName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "원본 파일명"),
  76. HashedName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "저장 파일명(해시)"),
  77. Path = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false, comment: "상대 경로"),
  78. Url = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "접근 URL"),
  79. Extension = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true, comment: "확장자"),
  80. ContentType = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "MIME"),
  81. Size = table.Column<long>(type: "bigint", nullable: true, comment: "바이트 크기"),
  82. Width = table.Column<short>(type: "smallint", nullable: true, comment: "가로 픽셀"),
  83. Height = table.Column<short>(type: "smallint", nullable: true, comment: "세로 픽셀"),
  84. Order = table.Column<int>(type: "int", nullable: false, comment: "정렬 순서"),
  85. IsDisabled = table.Column<bool>(type: "bit", nullable: false, comment: "비활성 여부"),
  86. DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "비활성 일시"),
  87. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  88. },
  89. constraints: table =>
  90. {
  91. table.PrimaryKey("PK_GameImage", x => x.ID);
  92. table.ForeignKey(
  93. name: "FK_GameImage_Game_GameID",
  94. column: x => x.GameID,
  95. principalTable: "Game",
  96. principalColumn: "ID",
  97. onDelete: ReferentialAction.Cascade);
  98. },
  99. comment: "게임 상세 이미지 갤러리");
  100. migrationBuilder.CreateTable(
  101. name: "GameCategoryMap",
  102. columns: table => new
  103. {
  104. GameID = table.Column<int>(type: "int", nullable: false),
  105. GameCategoryID = table.Column<int>(type: "int", nullable: false)
  106. },
  107. constraints: table =>
  108. {
  109. table.PrimaryKey("PK_GameCategoryMap", x => new { x.GameID, x.GameCategoryID });
  110. table.ForeignKey(
  111. name: "FK_GameCategoryMap_GameCategory_GameCategoryID",
  112. column: x => x.GameCategoryID,
  113. principalTable: "GameCategory",
  114. principalColumn: "ID",
  115. onDelete: ReferentialAction.Cascade);
  116. table.ForeignKey(
  117. name: "FK_GameCategoryMap_Game_GameID",
  118. column: x => x.GameID,
  119. principalTable: "Game",
  120. principalColumn: "ID",
  121. onDelete: ReferentialAction.Cascade);
  122. },
  123. comment: "게임-카테고리 N:M");
  124. migrationBuilder.CreateTable(
  125. name: "GameGenreMap",
  126. columns: table => new
  127. {
  128. GameID = table.Column<int>(type: "int", nullable: false),
  129. GameGenreID = table.Column<int>(type: "int", nullable: false)
  130. },
  131. constraints: table =>
  132. {
  133. table.PrimaryKey("PK_GameGenreMap", x => new { x.GameID, x.GameGenreID });
  134. table.ForeignKey(
  135. name: "FK_GameGenreMap_GameGenre_GameGenreID",
  136. column: x => x.GameGenreID,
  137. principalTable: "GameGenre",
  138. principalColumn: "ID",
  139. onDelete: ReferentialAction.Cascade);
  140. table.ForeignKey(
  141. name: "FK_GameGenreMap_Game_GameID",
  142. column: x => x.GameID,
  143. principalTable: "Game",
  144. principalColumn: "ID",
  145. onDelete: ReferentialAction.Cascade);
  146. },
  147. comment: "게임-장르 N:M");
  148. migrationBuilder.CreateIndex(
  149. name: "IX_GameCategory_IsActive_Order",
  150. table: "GameCategory",
  151. columns: new[] { "IsActive", "Order" });
  152. migrationBuilder.CreateIndex(
  153. name: "IX_GameCategory_KorName",
  154. table: "GameCategory",
  155. column: "KorName",
  156. unique: true);
  157. migrationBuilder.CreateIndex(
  158. name: "IX_GameCategoryMap_GameCategoryID",
  159. table: "GameCategoryMap",
  160. column: "GameCategoryID");
  161. migrationBuilder.CreateIndex(
  162. name: "IX_GameGenre_IsActive_Order",
  163. table: "GameGenre",
  164. columns: new[] { "IsActive", "Order" });
  165. migrationBuilder.CreateIndex(
  166. name: "IX_GameGenre_KorName",
  167. table: "GameGenre",
  168. column: "KorName",
  169. unique: true);
  170. migrationBuilder.CreateIndex(
  171. name: "IX_GameGenreMap_GameGenreID",
  172. table: "GameGenreMap",
  173. column: "GameGenreID");
  174. migrationBuilder.CreateIndex(
  175. name: "IX_GameImage_GameID",
  176. table: "GameImage",
  177. column: "GameID");
  178. migrationBuilder.CreateIndex(
  179. name: "IX_GameImage_GameID_IsDisabled",
  180. table: "GameImage",
  181. columns: new[] { "GameID", "IsDisabled" });
  182. migrationBuilder.CreateIndex(
  183. name: "IX_GameImage_UUID",
  184. table: "GameImage",
  185. column: "UUID",
  186. unique: true);
  187. }
  188. /// <inheritdoc />
  189. protected override void Down(MigrationBuilder migrationBuilder)
  190. {
  191. migrationBuilder.DropTable(
  192. name: "GameCategoryMap");
  193. migrationBuilder.DropTable(
  194. name: "GameGenreMap");
  195. migrationBuilder.DropTable(
  196. name: "GameImage");
  197. migrationBuilder.DropTable(
  198. name: "GameCategory");
  199. migrationBuilder.DropTable(
  200. name: "GameGenre");
  201. migrationBuilder.DropColumn(
  202. name: "MinSpec",
  203. table: "Game");
  204. migrationBuilder.DropColumn(
  205. name: "RecommendedSpec",
  206. table: "Game");
  207. migrationBuilder.DropColumn(
  208. name: "TrailerUrl",
  209. table: "Game");
  210. }
  211. }
  212. }