using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Persistence.Migrations
{
///
public partial class AddGameReleaseDateAndLanguages : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "ReleaseDate",
table: "Game",
type: "date",
nullable: true,
comment: "게임 출시일");
migrationBuilder.CreateTable(
name: "GameLanguage",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
KorName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "언어 한글명"),
EngName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "언어 영문명"),
Order = table.Column(type: "int", nullable: false),
IsActive = table.Column(type: "bit", nullable: false),
CreatedAt = table.Column(type: "datetime2", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GameLanguage", x => x.ID);
},
comment: "게임 지원 언어 마스터");
migrationBuilder.CreateTable(
name: "GameLanguageSupport",
columns: table => new
{
GameID = table.Column(type: "int", nullable: false),
GameLanguageID = table.Column(type: "int", nullable: false),
Interface = table.Column(type: "bit", nullable: false, comment: "인터페이스 지원"),
FullAudio = table.Column(type: "bit", nullable: false, comment: "풀 오디오(음성) 지원"),
Subtitles = table.Column(type: "bit", nullable: false, comment: "자막 지원")
},
constraints: table =>
{
table.PrimaryKey("PK_GameLanguageSupport", x => new { x.GameID, x.GameLanguageID });
table.ForeignKey(
name: "FK_GameLanguageSupport_GameLanguage_GameLanguageID",
column: x => x.GameLanguageID,
principalTable: "GameLanguage",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GameLanguageSupport_Game_GameID",
column: x => x.GameID,
principalTable: "Game",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
},
comment: "게임별 언어 지원 (인터페이스/풀오디오/자막)");
migrationBuilder.CreateIndex(
name: "IX_GameLanguage_IsActive_Order",
table: "GameLanguage",
columns: new[] { "IsActive", "Order" });
migrationBuilder.CreateIndex(
name: "IX_GameLanguage_KorName",
table: "GameLanguage",
column: "KorName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_GameLanguageSupport_GameLanguageID",
table: "GameLanguageSupport",
column: "GameLanguageID");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GameLanguageSupport");
migrationBuilder.DropTable(
name: "GameLanguage");
migrationBuilder.DropColumn(
name: "ReleaseDate",
table: "Game");
}
}
}