20260707100929_AddSeibroDividend.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddSeibroDividend : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "Dividend",
  14. columns: table => new
  15. {
  16. ID = table.Column<int>(type: "int", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. Isin = table.Column<string>(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목번호 (ISIN)"),
  19. KorSecnNm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "한글종목명 (KOR_SECN_NM)"),
  20. SecnKacdNm = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "종목종류 (SECN_KACD_NM) — 보통주/우선주…"),
  21. RgtStdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "권리기준일자 (RGT_STD_DT)"),
  22. Pval = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "액면가 (PVAL)"),
  23. StkAllocRatio = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "주식배정비율 (STK_ALOC_RATIO)"),
  24. CashAllocRatio = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "현금배정비율 (CASH_ALOC_RATIO)"),
  25. CashAllocAmt = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "현금배정금액 (CASH_ALOC_AMT) — 1주당 현금배당"),
  26. MartpDivRate = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "시가배당율 (MARTP_DIV_RATE)"),
  27. Th1PayTermBeginDt = table.Column<DateOnly>(type: "date", nullable: true, comment: "배당지급일(현금, TH1_PAY_TERM_BEGIN_DT)"),
  28. DeliDt = table.Column<DateOnly>(type: "date", nullable: true, comment: "교부일자(주식, DELI_DT)"),
  29. MajshrEtcDiffAllocYn = table.Column<bool>(type: "bit", nullable: true, comment: "대주주기타차등배정여부 (MAJSHR_ETC_DIFF_ALOC_YN)"),
  30. TstkNoagnYn = table.Column<bool>(type: "bit", nullable: true, comment: "자사주무배정여부 (TSTK_NOAGN_YN)"),
  31. CashDiffDiviAmt = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "현금차등배당금액 (CASH_DIFF_DIVIAMT_VAL)"),
  32. CashDiffDiviRate = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "현금차등배당율 (CASH_DIFF_DIVI_RATE)"),
  33. StkDiffDiviRate = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "주식차등배당율 (STK_DIFF_DIVI_RATE)"),
  34. MartpDiffDiviRate = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "시가차등배당율 (MARTP_DIFF_DIVI_RATE)"),
  35. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  36. },
  37. constraints: table =>
  38. {
  39. table.PrimaryKey("PK_Dividend", x => x.ID);
  40. },
  41. comment: "SEIBro 배당분배금내역 (getDivInfo) — 종목별 배정비율·금액·시가배당율. Isin 으로 Stock 조인");
  42. migrationBuilder.CreateTable(
  43. name: "DividendSchedule",
  44. columns: table => new
  45. {
  46. ID = table.Column<int>(type: "int", nullable: false)
  47. .Annotation("SqlServer:Identity", "1, 1"),
  48. IssucoCustno = table.Column<int>(type: "int", nullable: false, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
  49. RepSecnNm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "대표종목명 (REP_SECN_NM)"),
  50. RgtRacd = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "권리사유코드 (RGT_RACD) — 103 배당/분배"),
  51. RgtRsnDetailSortCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "권리사유세부유형코드 — 01주식 02현금 03동시 04무배당"),
  52. RgtStdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "권리기준일자 (RGT_STD_DT)"),
  53. AllocWhcd = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "배정방법코드 (ALOC_WHCD)"),
  54. SetaccTpcd = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "결산구분코드 (SETACC_TPCD)"),
  55. FixTpcd = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true, comment: "확정구분코드 (FIX_TPCD)"),
  56. RostCloseBeginDt = table.Column<DateOnly>(type: "date", nullable: true, comment: "명부폐쇄시작일자 (ROST_CLOSE_BEGIN_DT)"),
  57. RostCloseExpryDt = table.Column<DateOnly>(type: "date", nullable: true, comment: "명부폐쇄종료일자 (ROST_CLOSE_EXPRY_DT)"),
  58. XrgtDt = table.Column<DateOnly>(type: "date", nullable: true, comment: "권리락일자 (XRGT_DT)"),
  59. IsElectronicSecurity = table.Column<bool>(type: "bit", nullable: true, comment: "전자증권 여부 (ELTSC_YN)"),
  60. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  61. },
  62. constraints: table =>
  63. {
  64. table.PrimaryKey("PK_DividendSchedule", x => x.ID);
  65. },
  66. comment: "SEIBro 배당일정 (getDivSchedulInfo) — 현금/주식/동시/무배당 일정·권리락일");
  67. migrationBuilder.CreateTable(
  68. name: "RightsBaseDate",
  69. columns: table => new
  70. {
  71. ID = table.Column<int>(type: "int", nullable: false)
  72. .Annotation("SqlServer:Identity", "1, 1"),
  73. IssucoCustno = table.Column<int>(type: "int", nullable: false, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
  74. RepSecnNm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "대표종목명 (REP_SECN_NM)"),
  75. RgtStdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "권리기준일자 (RGT_STD_DT)"),
  76. RgtRacd = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false, comment: "권리사유코드 (RGT_RACD)"),
  77. RgtRacdNm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "권리사유명 (RGT_RACD_NM)"),
  78. RgtRsnDetailSortCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "권리사유세부유형코드 (RGT_RSN_DTAIL_SORT_CD)"),
  79. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  80. },
  81. constraints: table =>
  82. {
  83. table.PrimaryKey("PK_RightsBaseDate", x => x.ID);
  84. },
  85. comment: "SEIBro 권리기준일 (getStddtInfo) — Wave 3 기업행위 이벤트 발견 소스");
  86. migrationBuilder.CreateIndex(
  87. name: "IX_Dividend_Isin_RgtStdDt",
  88. table: "Dividend",
  89. columns: new[] { "Isin", "RgtStdDt" },
  90. unique: true);
  91. migrationBuilder.CreateIndex(
  92. name: "IX_Dividend_RgtStdDt",
  93. table: "Dividend",
  94. column: "RgtStdDt");
  95. migrationBuilder.CreateIndex(
  96. name: "IX_DividendSchedule_IssucoCustno_RgtStdDt_RgtRsnDetailSortCd",
  97. table: "DividendSchedule",
  98. columns: new[] { "IssucoCustno", "RgtStdDt", "RgtRsnDetailSortCd" },
  99. unique: true);
  100. migrationBuilder.CreateIndex(
  101. name: "IX_DividendSchedule_RgtStdDt",
  102. table: "DividendSchedule",
  103. column: "RgtStdDt");
  104. migrationBuilder.CreateIndex(
  105. name: "IX_DividendSchedule_XrgtDt",
  106. table: "DividendSchedule",
  107. column: "XrgtDt");
  108. migrationBuilder.CreateIndex(
  109. name: "IX_RightsBaseDate_IssucoCustno_RgtStdDt_RgtRacd_RgtRsnDetailSortCd",
  110. table: "RightsBaseDate",
  111. columns: new[] { "IssucoCustno", "RgtStdDt", "RgtRacd", "RgtRsnDetailSortCd" },
  112. unique: true);
  113. migrationBuilder.CreateIndex(
  114. name: "IX_RightsBaseDate_RgtRacd",
  115. table: "RightsBaseDate",
  116. column: "RgtRacd");
  117. migrationBuilder.CreateIndex(
  118. name: "IX_RightsBaseDate_RgtStdDt",
  119. table: "RightsBaseDate",
  120. column: "RgtStdDt");
  121. }
  122. /// <inheritdoc />
  123. protected override void Down(MigrationBuilder migrationBuilder)
  124. {
  125. migrationBuilder.DropTable(
  126. name: "Dividend");
  127. migrationBuilder.DropTable(
  128. name: "DividendSchedule");
  129. migrationBuilder.DropTable(
  130. name: "RightsBaseDate");
  131. }
  132. }
  133. }