using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class AddBondIndexDailyPrice : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "BondIndexDailyPrice", columns: table => new { ID = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), GroupName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "채권지수 그룹명 (BND_IDX_GRP_NM)"), TradeDate = table.Column(type: "date", nullable: false), TotalEarningIndex = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "총수익지수 (TOT_EARNG_IDX)"), TotalEarningChange = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "총수익지수 전일 대비"), NetPriceIndex = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "순가격지수 (NETPRC_IDX)"), NetPriceChange = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "순가격지수 전일 대비"), ZeroReinvestIndex = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "제로재투자지수 (ZERO_REINVST_IDX)"), ZeroReinvestChange = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "제로재투자지수 전일 대비"), CallReinvestIndex = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "Call재투자지수 (CALL_REINVST_IDX)"), CallReinvestChange = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "Call재투자지수 전일 대비"), MarketPriceIndex = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "시장가격지수 (MKT_PRC_IDX)"), MarketPriceChange = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "시장가격지수 전일 대비"), AvgDuration = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "평균 듀레이션 (AVG_DURATION)"), AvgConvexity = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "평균 컨벡시티 (AVG_CONVEXITY_PRC)"), AvgYield = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true, comment: "평균 만기수익률 YTM (BND_IDX_AVG_YD)"), CreatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_BondIndexDailyPrice", x => x.ID); }, comment: "채권지수 일별시세 (KRX OpenAPI idx/bon_dd_trd)"); migrationBuilder.CreateIndex( name: "IX_BondIndexDailyPrice_GroupName_TradeDate", table: "BondIndexDailyPrice", columns: new[] { "GroupName", "TradeDate" }, unique: true); migrationBuilder.CreateIndex( name: "IX_BondIndexDailyPrice_TradeDate", table: "BondIndexDailyPrice", column: "TradeDate"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "BondIndexDailyPrice"); } } }