| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Persistence.Migrations
- {
- /// <inheritdoc />
- public partial class AddGameDetailFields : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<string>(
- name: "MinSpec",
- table: "Game",
- type: "nvarchar(max)",
- nullable: true,
- comment: "최소 사양 (자유 텍스트)");
- migrationBuilder.AddColumn<string>(
- name: "RecommendedSpec",
- table: "Game",
- type: "nvarchar(max)",
- nullable: true,
- comment: "권장 사양 (자유 텍스트)");
- migrationBuilder.AddColumn<string>(
- name: "TrailerUrl",
- table: "Game",
- type: "nvarchar(500)",
- maxLength: 500,
- nullable: true,
- comment: "YouTube 예고편 URL");
- migrationBuilder.CreateTable(
- name: "GameCategory",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- KorName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "카테고리 한글명"),
- EngName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "카테고리 영문명"),
- Order = table.Column<int>(type: "int", nullable: false),
- IsActive = table.Column<bool>(type: "bit", nullable: false),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_GameCategory", x => x.ID);
- },
- comment: "게임 카테고리 코드");
- migrationBuilder.CreateTable(
- name: "GameGenre",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- KorName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "장르 한글명"),
- EngName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "장르 영문명"),
- Order = table.Column<int>(type: "int", nullable: false),
- IsActive = table.Column<bool>(type: "bit", nullable: false),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_GameGenre", x => x.ID);
- },
- comment: "게임 장르 코드");
- migrationBuilder.CreateTable(
- name: "GameImage",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- GameID = table.Column<int>(type: "int", nullable: false),
- UUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "UUID"),
- FileName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "원본 파일명"),
- HashedName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "저장 파일명(해시)"),
- Path = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false, comment: "상대 경로"),
- Url = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "접근 URL"),
- Extension = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true, comment: "확장자"),
- ContentType = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "MIME"),
- Size = table.Column<long>(type: "bigint", nullable: true, comment: "바이트 크기"),
- Width = table.Column<short>(type: "smallint", nullable: true, comment: "가로 픽셀"),
- Height = table.Column<short>(type: "smallint", nullable: true, comment: "세로 픽셀"),
- Order = table.Column<int>(type: "int", nullable: false, comment: "정렬 순서"),
- IsDisabled = table.Column<bool>(type: "bit", nullable: false, comment: "비활성 여부"),
- DisabledAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "비활성 일시"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_GameImage", x => x.ID);
- table.ForeignKey(
- name: "FK_GameImage_Game_GameID",
- column: x => x.GameID,
- principalTable: "Game",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- },
- comment: "게임 상세 이미지 갤러리");
- migrationBuilder.CreateTable(
- name: "GameCategoryMap",
- columns: table => new
- {
- GameID = table.Column<int>(type: "int", nullable: false),
- GameCategoryID = table.Column<int>(type: "int", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_GameCategoryMap", x => new { x.GameID, x.GameCategoryID });
- table.ForeignKey(
- name: "FK_GameCategoryMap_GameCategory_GameCategoryID",
- column: x => x.GameCategoryID,
- principalTable: "GameCategory",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_GameCategoryMap_Game_GameID",
- column: x => x.GameID,
- principalTable: "Game",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- },
- comment: "게임-카테고리 N:M");
- migrationBuilder.CreateTable(
- name: "GameGenreMap",
- columns: table => new
- {
- GameID = table.Column<int>(type: "int", nullable: false),
- GameGenreID = table.Column<int>(type: "int", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_GameGenreMap", x => new { x.GameID, x.GameGenreID });
- table.ForeignKey(
- name: "FK_GameGenreMap_GameGenre_GameGenreID",
- column: x => x.GameGenreID,
- principalTable: "GameGenre",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_GameGenreMap_Game_GameID",
- column: x => x.GameID,
- principalTable: "Game",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- },
- comment: "게임-장르 N:M");
- migrationBuilder.CreateIndex(
- name: "IX_GameCategory_IsActive_Order",
- table: "GameCategory",
- columns: new[] { "IsActive", "Order" });
- migrationBuilder.CreateIndex(
- name: "IX_GameCategory_KorName",
- table: "GameCategory",
- column: "KorName",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_GameCategoryMap_GameCategoryID",
- table: "GameCategoryMap",
- column: "GameCategoryID");
- migrationBuilder.CreateIndex(
- name: "IX_GameGenre_IsActive_Order",
- table: "GameGenre",
- columns: new[] { "IsActive", "Order" });
- migrationBuilder.CreateIndex(
- name: "IX_GameGenre_KorName",
- table: "GameGenre",
- column: "KorName",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_GameGenreMap_GameGenreID",
- table: "GameGenreMap",
- column: "GameGenreID");
- migrationBuilder.CreateIndex(
- name: "IX_GameImage_GameID",
- table: "GameImage",
- column: "GameID");
- migrationBuilder.CreateIndex(
- name: "IX_GameImage_GameID_IsDisabled",
- table: "GameImage",
- columns: new[] { "GameID", "IsDisabled" });
- migrationBuilder.CreateIndex(
- name: "IX_GameImage_UUID",
- table: "GameImage",
- column: "UUID",
- unique: true);
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "GameCategoryMap");
- migrationBuilder.DropTable(
- name: "GameGenreMap");
- migrationBuilder.DropTable(
- name: "GameImage");
- migrationBuilder.DropTable(
- name: "GameCategory");
- migrationBuilder.DropTable(
- name: "GameGenre");
- migrationBuilder.DropColumn(
- name: "MinSpec",
- table: "Game");
- migrationBuilder.DropColumn(
- name: "RecommendedSpec",
- table: "Game");
- migrationBuilder.DropColumn(
- name: "TrailerUrl",
- table: "Game");
- }
- }
- }
|