using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class AddSeibroIssuerAndStockExtension : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "FaceValue", table: "Stock", type: "decimal(15,4)", precision: 15, scale: 4, nullable: true, comment: "액면가 (SEIBro PVAL)"); migrationBuilder.AddColumn( name: "IsElectronicSecurity", table: "Stock", type: "bit", nullable: true, comment: "전자증권 여부 (SEIBro ELTSC_YN)"); migrationBuilder.AddColumn( name: "IssucoCustno", table: "Stock", type: "int", nullable: true, comment: "SEIBro 발행회사 고객번호 (ISSUCO_CUSTNO) — 기업정보 API 조인키"); migrationBuilder.AddColumn( name: "TotalIssuedShares", table: "Stock", type: "bigint", nullable: true, comment: "총발행주식수 (SEIBro TOTAL_STK_CNT)"); migrationBuilder.AddColumn( name: "VotingRights", table: "Stock", type: "decimal(5,2)", precision: 5, scale: 2, nullable: true, comment: "1주당 의결권수 (SEIBro VOTRNO)"); migrationBuilder.CreateTable( name: "SeibroIssuerCode", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Market = table.Column(type: "nchar(2)", fixedLength: true, maxLength: 2, nullable: false, comment: "시장구분 (MART_TPCD) — 11유가/12코스닥/13K-OTC/14코넥스/50기타"), ShortCode = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "단축코드 (SHOTN_ISIN)"), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "종목명 (KOR_SECN_NM)"), IssucoCustno = table.Column(type: "int", nullable: false, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SeibroIssuerCode", x => x.ID); }, comment: "SEIBro 시장별 단축코드↔발행회사번호 매핑 (getShotnByMart)"); migrationBuilder.CreateIndex( name: "IX_Stock_IssucoCustno", table: "Stock", column: "IssucoCustno"); migrationBuilder.CreateIndex( name: "IX_SeibroIssuerCode_IssucoCustno", table: "SeibroIssuerCode", column: "IssucoCustno"); migrationBuilder.CreateIndex( name: "IX_SeibroIssuerCode_Market_ShortCode", table: "SeibroIssuerCode", columns: new[] { "Market", "ShortCode" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "SeibroIssuerCode"); migrationBuilder.DropIndex( name: "IX_Stock_IssucoCustno", table: "Stock"); migrationBuilder.DropColumn( name: "FaceValue", table: "Stock"); migrationBuilder.DropColumn( name: "IsElectronicSecurity", table: "Stock"); migrationBuilder.DropColumn( name: "IssucoCustno", table: "Stock"); migrationBuilder.DropColumn( name: "TotalIssuedShares", table: "Stock"); migrationBuilder.DropColumn( name: "VotingRights", table: "Stock"); } } }