20260706042207_AddBondIndexDailyPrice.cs 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddBondIndexDailyPrice : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "BondIndexDailyPrice",
  14. columns: table => new
  15. {
  16. ID = table.Column<long>(type: "bigint", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. GroupName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "채권지수 그룹명 (BND_IDX_GRP_NM)"),
  19. TradeDate = table.Column<DateOnly>(type: "date", nullable: false),
  20. TotalEarningIndex = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "총수익지수 (TOT_EARNG_IDX)"),
  21. TotalEarningChange = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "총수익지수 전일 대비"),
  22. NetPriceIndex = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "순가격지수 (NETPRC_IDX)"),
  23. NetPriceChange = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "순가격지수 전일 대비"),
  24. ZeroReinvestIndex = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "제로재투자지수 (ZERO_REINVST_IDX)"),
  25. ZeroReinvestChange = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "제로재투자지수 전일 대비"),
  26. CallReinvestIndex = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "Call재투자지수 (CALL_REINVST_IDX)"),
  27. CallReinvestChange = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "Call재투자지수 전일 대비"),
  28. MarketPriceIndex = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "시장가격지수 (MKT_PRC_IDX)"),
  29. MarketPriceChange = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "시장가격지수 전일 대비"),
  30. AvgDuration = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "평균 듀레이션 (AVG_DURATION)"),
  31. AvgConvexity = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "평균 컨벡시티 (AVG_CONVEXITY_PRC)"),
  32. AvgYield = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "평균 만기수익률 YTM (BND_IDX_AVG_YD)"),
  33. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  34. },
  35. constraints: table =>
  36. {
  37. table.PrimaryKey("PK_BondIndexDailyPrice", x => x.ID);
  38. },
  39. comment: "채권지수 일별시세 (KRX OpenAPI idx/bon_dd_trd)");
  40. migrationBuilder.CreateIndex(
  41. name: "IX_BondIndexDailyPrice_GroupName_TradeDate",
  42. table: "BondIndexDailyPrice",
  43. columns: new[] { "GroupName", "TradeDate" },
  44. unique: true);
  45. migrationBuilder.CreateIndex(
  46. name: "IX_BondIndexDailyPrice_TradeDate",
  47. table: "BondIndexDailyPrice",
  48. column: "TradeDate");
  49. }
  50. /// <inheritdoc />
  51. protected override void Down(MigrationBuilder migrationBuilder)
  52. {
  53. migrationBuilder.DropTable(
  54. name: "BondIndexDailyPrice");
  55. }
  56. }
  57. }