using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb
{
///
public partial class AddSeibroSupply : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ListingChangeEvent",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
IssucoCustno = table.Column(type: "int", nullable: true, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
Isin = table.Column(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목코드 (ISIN)"),
ShotnIsin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "단축코드 (SHOTN_ISIN)"),
KorSecnNm = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: false, comment: "종목명 (KOR_SECN_NM)"),
BfaltCirclForm = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "변경전 유통형태 (BFALT_CIRCL_FORM)"),
AfaltCirclForm = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "변경후 유통형태 (AFALT_CIRCL_FORM)"),
ApliDt = table.Column(type: "date", nullable: false, comment: "변경(적용)일자 (APLI_DT)"),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ListingChangeEvent", x => x.ID);
},
comment: "SEIBro 주식 상장(유통형태 변경) 정보 (getStkListInfo) — 월 윈도우 스윕, 적용일 기준 window delete+insert");
migrationBuilder.CreateTable(
name: "LockupEvent",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
IssucoCustno = table.Column(type: "int", nullable: false, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "한글종목명 (KOR_SECN_NM)"),
SecnKacd = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "종목종류 (SECN_KACD — 실응답은 명칭 문자열)"),
ShotnIsin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "단축코드 (SHOTN_ISIN)"),
MartTpcd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "시장구분 (MART_TPCD)"),
OccrSeq = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: false, comment: "업무구분 (OCCR_SEQ) — 1예수 2반환"),
SafedpDt = table.Column(type: "date", nullable: false, comment: "의무보호예수일 (SAFEDP_DT)"),
SafedpQty = table.Column(type: "bigint", nullable: true, comment: "예수주식수 (SAFEDP_QTY)"),
DutySafedpRacd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "보호예수사유코드 (DUTY_SAFEDP_RACD)"),
ReturnDt = table.Column(type: "date", nullable: true, comment: "반환일 (RETURN_DT)"),
ReturnQty = table.Column(type: "bigint", nullable: true, comment: "반환주식수 (RETURN_QTY)"),
TotalStkCnt = table.Column(type: "bigint", nullable: true, comment: "총발행주식수 (TOTAL_STK_CNT)"),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LockupEvent", x => x.ID);
},
comment: "SEIBro 의무보호예수/반환 (getSafeDpDutyDepoStatus) — 락업 예수/반환 일정·수량·사유");
migrationBuilder.CreateTable(
name: "SecuritiesLending",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Isin = table.Column(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목코드 (ISIN)"),
StdDt = table.Column(type: "date", nullable: false, comment: "기준일 (STD_DT)"),
TotIssuStkqty = table.Column(type: "bigint", nullable: true, comment: "총발행주식수 (TOT_ISSU_STKQTY)"),
TrQty = table.Column(type: "bigint", nullable: true, comment: "일일거래량 (TR_QTY)"),
MatcQty = table.Column(type: "bigint", nullable: true, comment: "대차체결량 (MATC_QTY)"),
RedQty = table.Column(type: "bigint", nullable: true, comment: "대차상환량 (RED_QTY)"),
SlbTrRemQty = table.Column(type: "bigint", nullable: true, comment: "대차잔고주수 (SLB_TR_REM_QTY)"),
FrinerLendRemAmt = table.Column(type: "bigint", nullable: true, comment: "외국인 대여잔고금액 (FRINER_LEND_REM_AMT)"),
FrinerLendRemRatio = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: true, comment: "외국인 대여잔고비율 (FRINER_LEND_REM_RATIO)"),
NativeLendRemAmt = table.Column(type: "bigint", nullable: true, comment: "내국인 대여잔고금액 (NATIVE_LEND_REM_AMT)"),
NativeLendRemRatio = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: true, comment: "내국인 대여잔고비율 (NATIVE_LEND_REM_RATIO)"),
FrinerBrwRemAmt = table.Column(type: "bigint", nullable: true, comment: "외국인 차입잔고금액 (FRINER_BRW_REM_AMT)"),
FrinerBrwRemRatio = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: true, comment: "외국인 차입잔고비율 (FRINER_BRW_REM_RATIO)"),
NativeBrwRemAmt = table.Column(type: "bigint", nullable: true, comment: "내국인 차입잔고금액 (NATIVE_BRW_REM_AMT)"),
NativeBrwRemRatio = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: true, comment: "내국인 차입잔고비율 (NATIVE_BRW_REM_RATIO)"),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SecuritiesLending", x => x.ID);
},
comment: "SEIBro 종목별 대차거래 현황 (getSlbDealingByIsin) — 대차잔고·외국인/내국인 대여·차입");
migrationBuilder.CreateTable(
name: "StockIssuanceChange",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
IssucoCustno = table.Column(type: "int", nullable: true, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
Isin = table.Column(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목번호 (ISIN)"),
SecnKacd = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: true, comment: "종목종류코드 (SECN_KACD)"),
SecnIssuNtimes = table.Column(type: "int", nullable: false, comment: "종목발행횟수 (SECN_ISSU_NTIMES)"),
IssuDt = table.Column(type: "date", nullable: false, comment: "발행일자 (ISSU_DT)"),
Issuprc = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "발행가 (ISSUPRC, 1주당)"),
IssuQty = table.Column(type: "bigint", nullable: true, comment: "발행수량 (ISSU_QTY) — 감소는 음수"),
SecnIssuRacd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: false, comment: "종목발행사유코드 (SECN_ISSU_RACD)"),
SecnIssuNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "종목발행사유명 (SECN_ISSU_NM)"),
ListDt = table.Column(type: "date", nullable: true, comment: "상장일자 (LIST_DT)"),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StockIssuanceChange", x => x.ID);
},
comment: "SEIBro 주식증감내역 (getStkIncdecDetails) — 발행횟수별 주식수 변동(액면분할·증자·소각)");
migrationBuilder.CreateTable(
name: "UnlistedCirculation",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Isin = table.Column(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목번호 (ISIN)"),
StdDt = table.Column(type: "date", nullable: false, comment: "기준일 (요청 STD_DT — 응답 미포함)"),
ShotnIsin = table.Column(type: "nvarchar(12)", maxLength: 12, nullable: true, comment: "단축코드 (SHOTN_ISIN)"),
RepSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "대표종목명 (REP_SECN_NM)"),
SecnKacdNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "종목종류 (SECN_KACD_NM — 스펙 SECN_KACA_NM 오기)"),
GenDepoQty = table.Column(type: "bigint", nullable: true, comment: "예탁수량 (GEN_DEPO_QTY)"),
RthingReturnStkqty = table.Column(type: "bigint", nullable: true, comment: "반환수량 (RTHING_RETURN_STKQTY)"),
AcnttrQty = table.Column(type: "bigint", nullable: true, comment: "계좌대체수량 (ACNTTR_QTY)"),
IsElectronicSecurity = table.Column(type: "bit", nullable: true, comment: "전자증권 여부 (ELTSC_YN)"),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UnlistedCirculation", x => x.ID);
},
comment: "SEIBro 비상장유통추정 정보 (getUnlistCirclInfo) — 비상장(K-OTC) 예탁/계좌대체/반환. StdDt 는 요청값 스탬핑");
migrationBuilder.CreateIndex(
name: "IX_ListingChangeEvent_ApliDt",
table: "ListingChangeEvent",
column: "ApliDt");
migrationBuilder.CreateIndex(
name: "IX_ListingChangeEvent_Isin_ApliDt_BfaltCirclForm_AfaltCirclForm",
table: "ListingChangeEvent",
columns: new[] { "Isin", "ApliDt", "BfaltCirclForm", "AfaltCirclForm" },
unique: true,
filter: "[BfaltCirclForm] IS NOT NULL AND [AfaltCirclForm] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_LockupEvent_IssucoCustno_ShotnIsin_SafedpDt_OccrSeq_DutySafedpRacd",
table: "LockupEvent",
columns: new[] { "IssucoCustno", "ShotnIsin", "SafedpDt", "OccrSeq", "DutySafedpRacd" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LockupEvent_ReturnDt",
table: "LockupEvent",
column: "ReturnDt");
migrationBuilder.CreateIndex(
name: "IX_LockupEvent_SafedpDt",
table: "LockupEvent",
column: "SafedpDt");
migrationBuilder.CreateIndex(
name: "IX_SecuritiesLending_Isin_StdDt",
table: "SecuritiesLending",
columns: new[] { "Isin", "StdDt" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SecuritiesLending_StdDt",
table: "SecuritiesLending",
column: "StdDt");
migrationBuilder.CreateIndex(
name: "IX_StockIssuanceChange_Isin_SecnIssuNtimes_IssuDt_SecnIssuRacd",
table: "StockIssuanceChange",
columns: new[] { "Isin", "SecnIssuNtimes", "IssuDt", "SecnIssuRacd" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_StockIssuanceChange_IssuDt",
table: "StockIssuanceChange",
column: "IssuDt");
migrationBuilder.CreateIndex(
name: "IX_UnlistedCirculation_Isin_StdDt",
table: "UnlistedCirculation",
columns: new[] { "Isin", "StdDt" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_UnlistedCirculation_StdDt",
table: "UnlistedCirculation",
column: "StdDt");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ListingChangeEvent");
migrationBuilder.DropTable(
name: "LockupEvent");
migrationBuilder.DropTable(
name: "SecuritiesLending");
migrationBuilder.DropTable(
name: "StockIssuanceChange");
migrationBuilder.DropTable(
name: "UnlistedCirculation");
}
}
}