using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class AddWarrantDailyTrade : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "WarrantDailyTrade", columns: table => new { ID = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), WarrantType = table.Column(type: "tinyint", nullable: false, comment: "신주인수권 구분 (1=증권, 2=증서)"), Code = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "단축코드 (ISU_CD) — 8자리 영숫자"), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "종목명"), Market = table.Column(type: "tinyint", nullable: false, comment: "시장 구분 (1=KOSPI, 2=KOSDAQ, 3=KONEX)"), TradeDate = table.Column(type: "date", nullable: false), Close = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "종가"), Open = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "시가"), High = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "고가"), Low = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "저가"), ChangeAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "전일 대비"), ChangeRate = table.Column(type: "decimal(7,2)", precision: 7, scale: 2, nullable: false, comment: "등락률 %"), Volume = table.Column(type: "bigint", nullable: false, comment: "거래량"), TradeValue = table.Column(type: "bigint", nullable: false, comment: "거래대금 (원)"), MarketCap = table.Column(type: "bigint", nullable: true, comment: "시가총액 (원)"), ListedShares = table.Column(type: "bigint", nullable: true, comment: "상장증권수"), TargetStockCode = table.Column(type: "nvarchar(6)", maxLength: 6, nullable: true, comment: "대상주식 단축코드 (TARSTK_ISU_SRT_CD)"), TargetStockName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "대상주식명 (TARSTK_ISU_NM)"), TargetStockPrice = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "대상주식 현재가 (TARSTK_ISU_PRSNT_PRC)"), ExercisePrice = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "행사가 (증권, EXER_PRC)"), ExerciseStartDate = table.Column(type: "date", nullable: true, comment: "행사 시작일 (증권, EXST_STRT_DD)"), ExerciseEndDate = table.Column(type: "date", nullable: true, comment: "행사 종료일 (증권, EXST_END_DD)"), IssuePrice = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "발행가 (증서, ISU_PRC)"), DelistDate = table.Column(type: "date", nullable: true, comment: "상장폐지일 (증서, DELIST_DD)"), CreatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WarrantDailyTrade", x => x.ID); }, comment: "신주인수권증권/증서 일별매매 시세 (KRX OpenAPI sto sw/sr)"); migrationBuilder.CreateIndex( name: "IX_WarrantDailyTrade_WarrantType_Code_TradeDate", table: "WarrantDailyTrade", columns: new[] { "WarrantType", "Code", "TradeDate" }, unique: true); migrationBuilder.CreateIndex( name: "IX_WarrantDailyTrade_WarrantType_TradeDate_TradeValue", table: "WarrantDailyTrade", columns: new[] { "WarrantType", "TradeDate", "TradeValue" }, descending: new[] { false, false, true }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "WarrantDailyTrade"); } } }