20260618074053_AddGameReleaseDateAndLanguages.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Persistence.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class AddGameReleaseDateAndLanguages : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AddColumn<DateOnly>(
  13. name: "ReleaseDate",
  14. table: "Game",
  15. type: "date",
  16. nullable: true,
  17. comment: "게임 출시일");
  18. migrationBuilder.CreateTable(
  19. name: "GameLanguage",
  20. columns: table => new
  21. {
  22. ID = table.Column<int>(type: "int", nullable: false)
  23. .Annotation("SqlServer:Identity", "1, 1"),
  24. KorName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "언어 한글명"),
  25. EngName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "언어 영문명"),
  26. Order = table.Column<int>(type: "int", nullable: false),
  27. IsActive = table.Column<bool>(type: "bit", nullable: false),
  28. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  29. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
  30. },
  31. constraints: table =>
  32. {
  33. table.PrimaryKey("PK_GameLanguage", x => x.ID);
  34. },
  35. comment: "게임 지원 언어 마스터");
  36. migrationBuilder.CreateTable(
  37. name: "GameLanguageSupport",
  38. columns: table => new
  39. {
  40. GameID = table.Column<int>(type: "int", nullable: false),
  41. GameLanguageID = table.Column<int>(type: "int", nullable: false),
  42. Interface = table.Column<bool>(type: "bit", nullable: false, comment: "인터페이스 지원"),
  43. FullAudio = table.Column<bool>(type: "bit", nullable: false, comment: "풀 오디오(음성) 지원"),
  44. Subtitles = table.Column<bool>(type: "bit", nullable: false, comment: "자막 지원")
  45. },
  46. constraints: table =>
  47. {
  48. table.PrimaryKey("PK_GameLanguageSupport", x => new { x.GameID, x.GameLanguageID });
  49. table.ForeignKey(
  50. name: "FK_GameLanguageSupport_GameLanguage_GameLanguageID",
  51. column: x => x.GameLanguageID,
  52. principalTable: "GameLanguage",
  53. principalColumn: "ID",
  54. onDelete: ReferentialAction.Cascade);
  55. table.ForeignKey(
  56. name: "FK_GameLanguageSupport_Game_GameID",
  57. column: x => x.GameID,
  58. principalTable: "Game",
  59. principalColumn: "ID",
  60. onDelete: ReferentialAction.Cascade);
  61. },
  62. comment: "게임별 언어 지원 (인터페이스/풀오디오/자막)");
  63. migrationBuilder.CreateIndex(
  64. name: "IX_GameLanguage_IsActive_Order",
  65. table: "GameLanguage",
  66. columns: new[] { "IsActive", "Order" });
  67. migrationBuilder.CreateIndex(
  68. name: "IX_GameLanguage_KorName",
  69. table: "GameLanguage",
  70. column: "KorName",
  71. unique: true);
  72. migrationBuilder.CreateIndex(
  73. name: "IX_GameLanguageSupport_GameLanguageID",
  74. table: "GameLanguageSupport",
  75. column: "GameLanguageID");
  76. }
  77. /// <inheritdoc />
  78. protected override void Down(MigrationBuilder migrationBuilder)
  79. {
  80. migrationBuilder.DropTable(
  81. name: "GameLanguageSupport");
  82. migrationBuilder.DropTable(
  83. name: "GameLanguage");
  84. migrationBuilder.DropColumn(
  85. name: "ReleaseDate",
  86. table: "Game");
  87. }
  88. }
  89. }