| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class EnrichGameWithFdmboxFields : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- // 기존 Name 인덱스 제거
- migrationBuilder.DropIndex(
- name: "IX_Game_Name",
- table: "Game");
- // Name → KorName 컬럼 rename (기존 데이터 보존)
- migrationBuilder.Sql("EXEC sp_rename N'[Game].[Name]', N'KorName', N'COLUMN';");
- // KorName 컬럼 길이/주석 변경 (nvarchar(100) → nvarchar(255))
- migrationBuilder.AlterColumn<string>(
- name: "KorName",
- table: "Game",
- type: "nvarchar(255)",
- maxLength: 255,
- nullable: false,
- comment: "게임 한글명",
- oldClrType: typeof(string),
- oldType: "nvarchar(100)",
- oldMaxLength: 100,
- oldComment: "게임 이름");
- // Description : nvarchar(2000) → nvarchar(max)
- migrationBuilder.AlterColumn<string>(
- name: "Description",
- table: "Game",
- type: "nvarchar(max)",
- nullable: true,
- comment: "게임 소개 (CKEditor HTML)",
- oldClrType: typeof(string),
- oldType: "nvarchar(2000)",
- oldMaxLength: 2000,
- oldNullable: true);
- // 신규 컬럼: Code (6자 UNIQUE filtered)
- migrationBuilder.AddColumn<string>(
- name: "Code",
- table: "Game",
- type: "nvarchar(6)",
- maxLength: 6,
- nullable: true,
- comment: "게임 코드 (UNIQUE, 외부 연동/내부 식별)");
- // 신규 컬럼: EngName
- migrationBuilder.AddColumn<string>(
- name: "EngName",
- table: "Game",
- type: "nvarchar(255)",
- maxLength: 255,
- nullable: true,
- comment: "게임 영문명");
- // 신규 컬럼: Link
- migrationBuilder.AddColumn<string>(
- name: "Link",
- table: "Game",
- type: "nvarchar(255)",
- maxLength: 255,
- nullable: true,
- comment: "게임 다운로드/공식 사이트 주소");
- // KorName UNIQUE
- migrationBuilder.CreateIndex(
- name: "IX_Game_KorName",
- table: "Game",
- column: "KorName",
- unique: true);
- // Code UNIQUE (NULL 제외)
- migrationBuilder.CreateIndex(
- name: "IX_Game_Code",
- table: "Game",
- column: "Code",
- unique: true,
- filter: "[Code] IS NOT NULL");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_Game_Code",
- table: "Game");
- migrationBuilder.DropIndex(
- name: "IX_Game_KorName",
- table: "Game");
- migrationBuilder.DropColumn(
- name: "Code",
- table: "Game");
- migrationBuilder.DropColumn(
- name: "EngName",
- table: "Game");
- migrationBuilder.DropColumn(
- name: "Link",
- table: "Game");
- migrationBuilder.AlterColumn<string>(
- name: "Description",
- table: "Game",
- type: "nvarchar(2000)",
- maxLength: 2000,
- nullable: true,
- oldClrType: typeof(string),
- oldType: "nvarchar(max)",
- oldNullable: true,
- oldComment: "게임 소개 (CKEditor HTML)");
- migrationBuilder.AlterColumn<string>(
- name: "KorName",
- table: "Game",
- type: "nvarchar(100)",
- maxLength: 100,
- nullable: false,
- comment: "게임 이름",
- oldClrType: typeof(string),
- oldType: "nvarchar(255)",
- oldMaxLength: 255,
- oldComment: "게임 한글명");
- migrationBuilder.Sql("EXEC sp_rename N'[Game].[KorName]', N'Name', N'COLUMN';");
- migrationBuilder.CreateIndex(
- name: "IX_Game_Name",
- table: "Game",
- column: "Name",
- unique: true);
- }
- }
- }
|