using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb
{
///
public partial class AddSeibroDividend : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Dividend",
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)"),
KorSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "한글종목명 (KOR_SECN_NM)"),
SecnKacdNm = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "종목종류 (SECN_KACD_NM) — 보통주/우선주…"),
RgtStdDt = table.Column(type: "date", nullable: false, comment: "권리기준일자 (RGT_STD_DT)"),
Pval = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "액면가 (PVAL)"),
StkAllocRatio = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "주식배정비율 (STK_ALOC_RATIO)"),
CashAllocRatio = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "현금배정비율 (CASH_ALOC_RATIO)"),
CashAllocAmt = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "현금배정금액 (CASH_ALOC_AMT) — 1주당 현금배당"),
MartpDivRate = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "시가배당율 (MARTP_DIV_RATE)"),
Th1PayTermBeginDt = table.Column(type: "date", nullable: true, comment: "배당지급일(현금, TH1_PAY_TERM_BEGIN_DT)"),
DeliDt = table.Column(type: "date", nullable: true, comment: "교부일자(주식, DELI_DT)"),
MajshrEtcDiffAllocYn = table.Column(type: "bit", nullable: true, comment: "대주주기타차등배정여부 (MAJSHR_ETC_DIFF_ALOC_YN)"),
TstkNoagnYn = table.Column(type: "bit", nullable: true, comment: "자사주무배정여부 (TSTK_NOAGN_YN)"),
CashDiffDiviAmt = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "현금차등배당금액 (CASH_DIFF_DIVIAMT_VAL)"),
CashDiffDiviRate = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "현금차등배당율 (CASH_DIFF_DIVI_RATE)"),
StkDiffDiviRate = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "주식차등배당율 (STK_DIFF_DIVI_RATE)"),
MartpDiffDiviRate = table.Column(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "시가차등배당율 (MARTP_DIFF_DIVI_RATE)"),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Dividend", x => x.ID);
},
comment: "SEIBro 배당분배금내역 (getDivInfo) — 종목별 배정비율·금액·시가배당율. Isin 으로 Stock 조인");
migrationBuilder.CreateTable(
name: "DividendSchedule",
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)"),
RepSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "대표종목명 (REP_SECN_NM)"),
RgtRacd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "권리사유코드 (RGT_RACD) — 103 배당/분배"),
RgtRsnDetailSortCd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "권리사유세부유형코드 — 01주식 02현금 03동시 04무배당"),
RgtStdDt = table.Column(type: "date", nullable: false, comment: "권리기준일자 (RGT_STD_DT)"),
AllocWhcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "배정방법코드 (ALOC_WHCD)"),
SetaccTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "결산구분코드 (SETACC_TPCD)"),
FixTpcd = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "확정구분코드 (FIX_TPCD)"),
RostCloseBeginDt = table.Column(type: "date", nullable: true, comment: "명부폐쇄시작일자 (ROST_CLOSE_BEGIN_DT)"),
RostCloseExpryDt = table.Column(type: "date", nullable: true, comment: "명부폐쇄종료일자 (ROST_CLOSE_EXPRY_DT)"),
XrgtDt = table.Column(type: "date", nullable: true, comment: "권리락일자 (XRGT_DT)"),
IsElectronicSecurity = table.Column(type: "bit", nullable: true, comment: "전자증권 여부 (ELTSC_YN)"),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DividendSchedule", x => x.ID);
},
comment: "SEIBro 배당일정 (getDivSchedulInfo) — 현금/주식/동시/무배당 일정·권리락일");
migrationBuilder.CreateTable(
name: "RightsBaseDate",
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)"),
RepSecnNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "대표종목명 (REP_SECN_NM)"),
RgtStdDt = table.Column(type: "date", nullable: false, comment: "권리기준일자 (RGT_STD_DT)"),
RgtRacd = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: false, comment: "권리사유코드 (RGT_RACD)"),
RgtRacdNm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "권리사유명 (RGT_RACD_NM)"),
RgtRsnDetailSortCd = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "권리사유세부유형코드 (RGT_RSN_DTAIL_SORT_CD)"),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RightsBaseDate", x => x.ID);
},
comment: "SEIBro 권리기준일 (getStddtInfo) — Wave 3 기업행위 이벤트 발견 소스");
migrationBuilder.CreateIndex(
name: "IX_Dividend_Isin_RgtStdDt",
table: "Dividend",
columns: new[] { "Isin", "RgtStdDt" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Dividend_RgtStdDt",
table: "Dividend",
column: "RgtStdDt");
migrationBuilder.CreateIndex(
name: "IX_DividendSchedule_IssucoCustno_RgtStdDt_RgtRsnDetailSortCd",
table: "DividendSchedule",
columns: new[] { "IssucoCustno", "RgtStdDt", "RgtRsnDetailSortCd" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_DividendSchedule_RgtStdDt",
table: "DividendSchedule",
column: "RgtStdDt");
migrationBuilder.CreateIndex(
name: "IX_DividendSchedule_XrgtDt",
table: "DividendSchedule",
column: "XrgtDt");
migrationBuilder.CreateIndex(
name: "IX_RightsBaseDate_IssucoCustno_RgtStdDt_RgtRacd_RgtRsnDetailSortCd",
table: "RightsBaseDate",
columns: new[] { "IssucoCustno", "RgtStdDt", "RgtRacd", "RgtRsnDetailSortCd" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RightsBaseDate_RgtRacd",
table: "RightsBaseDate",
column: "RgtRacd");
migrationBuilder.CreateIndex(
name: "IX_RightsBaseDate_RgtStdDt",
table: "RightsBaseDate",
column: "RgtStdDt");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Dividend");
migrationBuilder.DropTable(
name: "DividendSchedule");
migrationBuilder.DropTable(
name: "RightsBaseDate");
}
}
}