using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class AddSeibroBond : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "BondEarlyRedemption", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Isin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN)"), KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "한글종목명 (KOR_SECN_NM)"), XrcBeginDt = table.Column(type: "date", nullable: true, comment: "행사시작일 (XRC_BEGIN_DT)"), XrcExpryDt = table.Column(type: "date", nullable: true, comment: "행사종료일 (XRC_EXPRY_DT)"), ErlyRedDt = table.Column(type: "date", nullable: false, comment: "조기상환일 (ERLY_RED_DT)"), OptionTpcd = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: true, comment: "옵션구분코드 (OPTION_TPCD)"), ApliIrate = table.Column(type: "decimal(15,10)", nullable: true, comment: "적용이자율 (APLI_IRATE)"), ErlyRedamtVal = table.Column(type: "decimal(20,2)", nullable: true, comment: "조기상환금액 (ERLY_REDAMT_VAL)"), IntPayAmt = table.Column(type: "decimal(20,2)", nullable: true, comment: "이자지급금액 (INT_PAY_AMT)"), IssuRema = table.Column(type: "decimal(20,2)", nullable: true, comment: "최근발행잔액 (ISSU_REMA)"), XrcRatio = table.Column(type: "decimal(15,10)", nullable: true, comment: "행사비율 (XRC_RATIO)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_BondEarlyRedemption", x => x.ID); }, comment: "SEIBro 채권 조기상환 정보 (getBondOptionXrcInfo) — Call/Put 옵션 행사 조기상환. 조기상환일 날짜 스윕"); migrationBuilder.CreateTable( name: "BondInterestPayment", columns: table => new { Isin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN, 요청값 스탬핑)"), CouponRate = table.Column(type: "decimal(15,10)", nullable: true, comment: "표면이자율 (COUPON_RATE)"), IntPayWayTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "이자지급방법구분코드 (INT_PAY_WAY_TPCD)"), IntPayCycleTerms = table.Column(type: "int", nullable: true, comment: "이자지급주기기간수 (INT_PAY_CYCLE_TERMS)"), IntPayCycleTpcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "이자지급주기구분코드 (INT_PAY_CYCLE_TPCD)"), RvltSeverTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "절상절사구분코드 (RVLT_SEVER_TPCD)"), AcrintPayYn = table.Column(type: "bit", nullable: true, comment: "경과이자지급여부 (ACRINT_PAY_YN)"), BankHolidayIntPaydayTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "은행휴무일이자지급일구분코드 (BANK_HOLIDAY_INT_PAYDD_TPCD)"), IntPayTimsTpcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "이자지급시기구분코드 (INT_PAY_TIMS_TPCD)"), BeforeDate = table.Column(type: "date", nullable: true, comment: "직전이표일 (BEFORE_DATE)"), AfterDate = table.Column(type: "date", nullable: true, comment: "차기이표일 (AFTER_DATE)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_BondInterestPayment", x => x.Isin); }, comment: "SEIBro 채권 이자지급 정보 (getIntPayInfo) — 이자지급 주기·방식·직전/차기 이표일. PK Isin 스냅샷"); migrationBuilder.CreateTable( name: "BondIssuance", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), IssuDt = table.Column(type: "date", nullable: false, comment: "발행일자 (ISSU_DT)"), IssucoCustno = table.Column(type: "int", nullable: true, comment: "발행회사고객번호 (ISSUCO_CUSTNO)"), IssucoCustNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "발행회사 명칭 (ISSUCO_CUST_NM)"), Isin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN)"), KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "한글종목명 (KOR_SECN_NM)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_BondIssuance", x => x.ID); }, comment: "SEIBro 채권 발행내역 (getBondIssuInfo) — 회사채·주식관련사채. BondMaster rolling 발견 소스"); migrationBuilder.CreateTable( name: "BondMaster", columns: table => new { Isin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN)"), IssucoCustno = table.Column(type: "int", nullable: true, comment: "발행사 번호 (ISSUCO_CUSTNO)"), KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "한글종목명 (KOR_SECN_NM)"), SecnKacd = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: true, comment: "종목종류코드 (SECN_KACD)"), IssuDt = table.Column(type: "date", nullable: true, comment: "발행일자 (ISSU_DT)"), XpirDt = table.Column(type: "date", nullable: true, comment: "만기일자 (XPIR_DT)"), IssuCurCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "발행통화코드 (ISSU_CUR_CD)"), FirstIssuAmt = table.Column(type: "decimal(24,4)", nullable: true, comment: "최초발행금액 (FIRST_ISSU_AMT)"), IssuRema = table.Column(type: "decimal(20,2)", nullable: true, comment: "발행잔액 (ISSU_REMA)"), PayinAmt = table.Column(type: "decimal(20,2)", nullable: true, comment: "납입금액 (PAYIN_AMT)"), CouponRate = table.Column(type: "decimal(15,10)", nullable: true, comment: "표면이자율 (COUPON_RATE)"), XpiredRate = table.Column(type: "decimal(16,10)", nullable: true, comment: "만기상환율 (XPIRED_RATE)"), RecuWhcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "모집방법코드 (RECU_WHCD)"), IssuWhcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "발행방법코드 (ISSU_WHCD)"), ParticulBondKindTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "특이채권종류구분코드 (PARTICUL_BOND_KIND_TPCD)"), OptionTpcd = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: true, comment: "옵션구분코드 (OPTION_TPCD)"), ForcErlyRedYn = table.Column(type: "bit", nullable: true, comment: "강제조기상환여부 (FORC_ERLY_RED_YN)"), MrChgTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "금리변동구분코드 (MR_CHG_TPCD)"), RegiOrgTpcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "등록기관구분코드 (REGI_ORG_TPCD)"), GrtyTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "보증구분코드 (GRTY_TPCD)"), SignaTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "기명구분코드 (SIGNA_TPCD)"), RankTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "순위구분코드 (RANK_TPCD)"), IntPayWayTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "이자지급방법구분코드 (INT_PAY_WAY_TPCD)"), SintCintTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "단리복리구분코드 (SINT_CINT_TPCD)"), IrateChgTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "이자율변동구분코드 (IRATE_CHG_TPCD)"), XpirGuarPrate = table.Column(type: "decimal(15,10)", nullable: true, comment: "만기보장수익율 (XPIR_GUAR_PRATE)"), XpirGuarPrateTpcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "만기보장수익율구분코드 (XPIR_GUAR_PRATE_TPCD)"), PrcpRedWhcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "원금상환방법코드 (PRCP_RED_WHCD)"), ApliDt = table.Column(type: "date", nullable: true, comment: "상장일 (APLI_DT)"), DlistDt = table.Column(type: "date", nullable: true, comment: "상장폐지일자 (DLIST_DT)"), KisValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "KIS평가등급코드 (KIS_VALAT_GRD_CD)"), NiceValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "NICE평가등급코드 (NICE_VALAT_GRD_CD)"), SciValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "서울신용평가등급코드 (SCI_VALAT_GRD_CD)"), KrValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "한국기업평가등급코드 (KR_VALAT_GRD_CD)"), EltscYn = table.Column(type: "bit", nullable: true, comment: "전자증권여부 (ELTSC_YN)"), ExerMbodyTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "권리행사주체 (EXER_MBODY_TPCD)"), IntEstmMannTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "이자산정방식 (INT_ESTM_MANN_TPCD)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_BondMaster", x => x.Isin); }, comment: "SEIBro 채권 종목 정보 (getBondStatInfo) — 만기·표면이자율·옵션·보증·신용등급 4사(KIS/NICE/SCI/KR). 신용등급 유일 소스"); migrationBuilder.CreateTable( name: "CdMaster", columns: table => new { Isin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN, 요청값 스탬핑)"), IssucoCustno = table.Column(type: "int", nullable: true, comment: "발행사 번호 (ISSUCO_CUSTNO)"), KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "한글종목명 (KOR_SECN_NM)"), IssuCurCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "발행통화코드 (ISSU_CUR_CD)"), FirstIssuAmt = table.Column(type: "decimal(24,4)", nullable: true, comment: "최초발행금액 (FIRST_ISSU_AMT)"), IssuWhcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "발행방법코드 (ISSU_WHCD)"), FaceAmt = table.Column(type: "decimal(20,2)", nullable: true, comment: "액면금액 (FACE_AMT)"), SaleAmt = table.Column(type: "decimal(20,2)", nullable: true, comment: "매출금액 (SALE_AMT)"), DiscnRate = table.Column(type: "decimal(15,10)", nullable: true, comment: "할인율 (DISCN_RATE)"), IntPayMannTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "이자지급방식구분코드 (INT_PAY_MANN_TPCD)"), IssuDt = table.Column(type: "date", nullable: true, comment: "발행일자 (ISSU_DT)"), XpirDt = table.Column(type: "date", nullable: true, comment: "만기일자 (XPIR_DT) — CD 상환일"), EltscYn = table.Column(type: "bit", nullable: true, comment: "전자증권 여부 (ELTSC_YN)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CdMaster", x => x.Isin); }, comment: "SEIBro CD 종목 정보 (getCDInfo) — 발행금액·할인율·이자지급방식·만기. PK Isin"); migrationBuilder.CreateTable( name: "CpMaster", columns: table => new { Isin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN, 요청값 스탬핑)"), IssucoCustno = table.Column(type: "int", nullable: true, comment: "발행사 번호 (ISSUCO_CUSTNO)"), KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "한글종목명 (KOR_SECN_NM)"), IssuCurCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "발행통화코드 (ISSU_CUR_CD)"), IssuAmt = table.Column(type: "decimal(24,4)", nullable: true, comment: "발행금액 (ISSU_AMT)"), SecnKacd = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: true, comment: "종목종류코드 (SECN_KACD)"), BillCacd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "어음분류코드 (BILL_CACD)"), IssuWhcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "발행방법코드 (ISSU_WHCD)"), SaleDt = table.Column(type: "date", nullable: true, comment: "매출일자 (SALE_DT)"), IntPayMannTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "이자지급방식구분코드 (INT_PAY_MANN_TPCD)"), IssuDt = table.Column(type: "date", nullable: true, comment: "발행일자 (ISSU_DT)"), XpirDt = table.Column(type: "date", nullable: true, comment: "만기일자 (XPIR_DT)"), DiscnOrgCustno = table.Column(type: "int", nullable: true, comment: "할인기관고객번호 (DISCN_ORG_CUSTNO)"), DiscnOrdNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "할인기관명 (DISCN_ORD_NM)"), PayBankBrono = table.Column(type: "int", nullable: true, comment: "지급은행지점번호 (PAY_BANK_BRONO)"), BankNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "지급은행명 (BANK_NM)"), WholdTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "원천징수구분코드 (WHOLD_TPCD)"), KisValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "KIS평가등급코드 (KIS_VALAT_GRD_CD)"), NiceValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "NICE평가등급코드 (NICE_VALAT_GRD_CD)"), SciValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "서울신용평가등급코드 (SCI_VALAT_GRD_CD)"), KrValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "한국기업평가등급코드 (KR_VALAT_GRD_CD)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CpMaster", x => x.Isin); }, comment: "SEIBro CP 종목 정보 (getCPInfo) — 발행·할인기관·지급은행·원천징수·신용등급 4사. PK Isin"); migrationBuilder.CreateTable( name: "EstbMaster", columns: table => new { Isin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN, 요청값 스탬핑)"), IssucoCustno = table.Column(type: "int", nullable: true, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"), EstbKacd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "전자단기사채종류코드 (ESTB_KACD)"), KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "한글종목명 (KOR_SECN_NM)"), IssuCurCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "발행통화코드 (ISSU_CUR_CD)"), IssuAmt = table.Column(type: "decimal(20,2)", nullable: true, comment: "발행금액 (ISSU_AMT)"), RecuWhcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "모집방법코드 (RECU_WHCD)"), IssuDt = table.Column(type: "date", nullable: true, comment: "발행일자 (ISSU_DT)"), XpirDt = table.Column(type: "date", nullable: true, comment: "만기일자 (XPIR_DT)"), Dayobj = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: true, comment: "일물 (DAYOBJ) — 만기일-발행일"), WholdYn = table.Column(type: "bit", nullable: true, comment: "원천징수여부 (WHOLD_YN)"), GrorgYn = table.Column(type: "bit", nullable: true, comment: "보증여부 (GRORG_YN)"), KisValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "KIS평가등급코드 (KIS_VALAT_GRD_CD)"), NiceValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "NICE평가등급코드 (NICE_VALAT_GRD_CD)"), SciValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "서울신용평가등급코드 (SCI_VALAT_GRD_CD)"), KrValatGrdCd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "한국기업평가등급코드 (KR_VALAT_GRD_CD)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_EstbMaster", x => x.Isin); }, comment: "SEIBro 전자단기사채 종목 정보 (getESTBInfo) — 발행·만기·일물·모집방법·신용등급 4사. PK Isin"); migrationBuilder.CreateTable( name: "ShortTermIssuance", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Isin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN)"), KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "한글종목명 (KOR_SECN_NM)"), IssucoCustno = table.Column(type: "int", nullable: true, comment: "발행회사고객번호 (ISSUCO_CUSTNO)"), IssucoCustNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "발행회사 명칭 (ISSUCO_CUST_NM)"), SecnTpcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "종목구분코드 (SECN_TPCD, 요청값 스탬핑) — 12어음(CP) 13CD 14전단채"), IssuDt = table.Column(type: "date", nullable: false, comment: "발행일자 (ISSU_DT, 요청값 스탬핑)"), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ShortTermIssuance", x => x.ID); }, comment: "SEIBro 단기금융증권 발행내역 (getShortmIssuInfo) — CD/CP/전단채. Cd/Cp/EstbMaster rolling 발견 소스"); migrationBuilder.CreateIndex( name: "IX_BondEarlyRedemption_ErlyRedDt", table: "BondEarlyRedemption", column: "ErlyRedDt"); migrationBuilder.CreateIndex( name: "IX_BondEarlyRedemption_Isin_ErlyRedDt", table: "BondEarlyRedemption", columns: new[] { "Isin", "ErlyRedDt" }, unique: true); migrationBuilder.CreateIndex( name: "IX_BondIssuance_Isin", table: "BondIssuance", column: "Isin", unique: true); migrationBuilder.CreateIndex( name: "IX_BondIssuance_IssuDt", table: "BondIssuance", column: "IssuDt"); migrationBuilder.CreateIndex( name: "IX_BondMaster_IssucoCustno", table: "BondMaster", column: "IssucoCustno"); migrationBuilder.CreateIndex( name: "IX_BondMaster_XpirDt", table: "BondMaster", column: "XpirDt"); migrationBuilder.CreateIndex( name: "IX_CdMaster_IssuDt", table: "CdMaster", column: "IssuDt"); migrationBuilder.CreateIndex( name: "IX_CpMaster_IssuDt", table: "CpMaster", column: "IssuDt"); migrationBuilder.CreateIndex( name: "IX_EstbMaster_IssuDt", table: "EstbMaster", column: "IssuDt"); migrationBuilder.CreateIndex( name: "IX_ShortTermIssuance_Isin", table: "ShortTermIssuance", column: "Isin", unique: true); migrationBuilder.CreateIndex( name: "IX_ShortTermIssuance_SecnTpcd_IssuDt", table: "ShortTermIssuance", columns: new[] { "SecnTpcd", "IssuDt" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "BondEarlyRedemption"); migrationBuilder.DropTable( name: "BondInterestPayment"); migrationBuilder.DropTable( name: "BondIssuance"); migrationBuilder.DropTable( name: "BondMaster"); migrationBuilder.DropTable( name: "CdMaster"); migrationBuilder.DropTable( name: "CpMaster"); migrationBuilder.DropTable( name: "EstbMaster"); migrationBuilder.DropTable( name: "ShortTermIssuance"); } } }