20260707145252_AddKosisMacro.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddKosisMacro : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "MacroIndicator",
  14. columns: table => new
  15. {
  16. ID = table.Column<long>(type: "bigint", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. Code = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false, comment: "지표 내부코드 (config Code)"),
  19. Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "지표 표시명"),
  20. Period = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: false, comment: "수록 시점 (PRD_DE — 월 YYYYMM / 분기 YYYYQ / 연 YYYY)"),
  21. Value = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false, comment: "수치 (DT)"),
  22. Unit = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true, comment: "단위 (UNIT_NM)"),
  23. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
  24. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  25. },
  26. constraints: table =>
  27. {
  28. table.PrimaryKey("PK_MacroIndicator", x => x.ID);
  29. },
  30. comment: "거시경제지표 시계열 (KOSIS 국가통계포털 OpenAPI 수집)");
  31. migrationBuilder.CreateIndex(
  32. name: "IX_MacroIndicator_Code_Period",
  33. table: "MacroIndicator",
  34. columns: new[] { "Code", "Period" },
  35. unique: true);
  36. }
  37. /// <inheritdoc />
  38. protected override void Down(MigrationBuilder migrationBuilder)
  39. {
  40. migrationBuilder.DropTable(
  41. name: "MacroIndicator");
  42. }
  43. }
  44. }