20260707011538_AddProofBoardAndBriefing.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddProofBoardAndBriefing : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AddColumn<bool>(
  13. name: "Write_RequireImage",
  14. table: "BoardMeta",
  15. type: "bit",
  16. nullable: false,
  17. defaultValue: false);
  18. migrationBuilder.CreateTable(
  19. name: "DailyBriefing",
  20. columns: table => new
  21. {
  22. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  23. .Annotation("SqlServer:Identity", "1, 1"),
  24. BriefingDate = table.Column<DateOnly>(type: "date", nullable: false, comment: "브리핑 대상 일자 (KST, UNIQUE)"),
  25. PostID = table.Column<int>(type: "int", nullable: false, comment: "발행된 게시글 ID (FK Post)"),
  26. GeneratedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "생성 일시")
  27. },
  28. constraints: table =>
  29. {
  30. table.PrimaryKey("PK_DailyBriefing", x => x.ID);
  31. table.ForeignKey(
  32. name: "FK_DailyBriefing_Post_PostID",
  33. column: x => x.PostID,
  34. principalTable: "Post",
  35. principalColumn: "ID",
  36. onDelete: ReferentialAction.Cascade);
  37. },
  38. comment: "장전 브리핑 발행 기록 (중복 발행 방지)");
  39. migrationBuilder.CreateIndex(
  40. name: "IX_DailyBriefing_BriefingDate",
  41. table: "DailyBriefing",
  42. column: "BriefingDate",
  43. unique: true);
  44. migrationBuilder.CreateIndex(
  45. name: "IX_DailyBriefing_PostID",
  46. table: "DailyBriefing",
  47. column: "PostID");
  48. }
  49. /// <inheritdoc />
  50. protected override void Down(MigrationBuilder migrationBuilder)
  51. {
  52. migrationBuilder.DropTable(
  53. name: "DailyBriefing");
  54. migrationBuilder.DropColumn(
  55. name: "Write_RequireImage",
  56. table: "BoardMeta");
  57. }
  58. }
  59. }