20260707130948_AddSeibroForeign.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddSeibroForeign : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "ForeignCustodyNation",
  14. columns: table => new
  15. {
  16. ID = table.Column<int>(type: "int", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. StdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "기준일자 (STD_DT, 스탬핑)"),
  19. NationCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "국가코드 (NATION_CD, 스탬핑) — US/JP/HK/CN/E1 등 43종"),
  20. SecnTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "종목구분코드 (SECN_TPCD) — 71외화주식~78외화수익증권"),
  21. FrsecCusAmt = table.Column<decimal>(type: "decimal(24,2)", nullable: true, comment: "외화증권보관금액 (FRSEC_CUS_AMT) — USD"),
  22. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  23. },
  24. constraints: table =>
  25. {
  26. table.PrimaryKey("PK_ForeignCustodyNation", x => x.ID);
  27. },
  28. comment: "SEIBro 국가별 외화증권 보관현황 (getNationFrsecCusInfo) — KSD 보관 외화증권 보관금액(USD), 국가×종목구분별. 서학개미 추이 소스");
  29. migrationBuilder.CreateTable(
  30. name: "ForeignCustodySecurity",
  31. columns: table => new
  32. {
  33. ID = table.Column<int>(type: "int", nullable: false)
  34. .Annotation("SqlServer:Identity", "1, 1"),
  35. StdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "기준일자 (STD_DT, 스탬핑)"),
  36. Isin = table.Column<string>(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN, 스탬핑)"),
  37. NationCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "국가코드 (NATION_CD)"),
  38. SecnTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "종목구분코드 (SECN_TPCD) — 71외화주식~78외화수익증권"),
  39. FrsecTotHoldAmt = table.Column<decimal>(type: "decimal(24,2)", nullable: true, comment: "외화증권보유금액 (FRSEC_TOT_HOLD_AMT) — USD"),
  40. FrsecTotHoldQty = table.Column<decimal>(type: "decimal(28,6)", nullable: true, comment: "외화증권총보유수량 (FRSEC_TOT_HOLD_QTY)"),
  41. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  42. },
  43. constraints: table =>
  44. {
  45. table.PrimaryKey("PK_ForeignCustodySecurity", x => x.ID);
  46. },
  47. comment: "SEIBro 종목별 외화증권 보관현황 (getSecnFrsecCusInfo) — 특정 외화종목(ISIN) 보유금액(USD)·보유수량. ForeignIsins seed 시 활성");
  48. migrationBuilder.CreateTable(
  49. name: "ForeignSettlementNation",
  50. columns: table => new
  51. {
  52. ID = table.Column<int>(type: "int", nullable: false)
  53. .Annotation("SqlServer:Identity", "1, 1"),
  54. SetlDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "결제일자 (SETL_DT, 스탬핑)"),
  55. NationCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "국가코드 (NATION_CD, 스탬핑) — US/JP/HK/CN/E1 등 43종"),
  56. IntlBizCacd = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false, comment: "국제업무분류코드 (INTL_BIZ_CACD) — 1110매수 1120매도"),
  57. SecnTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "종목구분코드 (SECN_TPCD) — 71외화주식~78외화수익증권"),
  58. SetlCount = table.Column<long>(type: "bigint", nullable: true, comment: "결제건수 (SETL_COUNT)"),
  59. FrsecSetlAmt = table.Column<decimal>(type: "decimal(30,10)", nullable: true, comment: "외화증권결제금액 (FRSEC_SETL_AMT) — USD, NUMBER(26,10)"),
  60. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  61. },
  62. constraints: table =>
  63. {
  64. table.PrimaryKey("PK_ForeignSettlementNation", x => x.ID);
  65. },
  66. comment: "SEIBro 국가별 외화증권 결제현황 (getNationFrsecSetlInfo) — KSD 결제 매수/매도 결제건수·금액(USD), 국가×매매×종목구분별");
  67. migrationBuilder.CreateTable(
  68. name: "ForeignSettlementSecurity",
  69. columns: table => new
  70. {
  71. ID = table.Column<int>(type: "int", nullable: false)
  72. .Annotation("SqlServer:Identity", "1, 1"),
  73. ProcDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "결제처리일 (PROC_DT, 스탬핑, 한국시간) — 미국시간 T일 결제는 T+1 반영"),
  74. Isin = table.Column<string>(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN, 스탬핑)"),
  75. IntlBizCacd = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false, comment: "국제업무분류코드 (INTL_BIZ_CACD) — 1110매수 1120매도"),
  76. NationCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "국가코드 (NATION_CD)"),
  77. SecnTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "종목구분코드 (SECN_TPCD) — 71외화주식~78외화수익증권"),
  78. SetlAskQty = table.Column<decimal>(type: "decimal(28,6)", nullable: true, comment: "결제신청수량 (SETL_ASK_QTY) — 주식:주, 채권:액면금액"),
  79. SetlAmt = table.Column<decimal>(type: "decimal(24,2)", nullable: true, comment: "결제금액 (SETL_AMT) — USD"),
  80. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  81. },
  82. constraints: table =>
  83. {
  84. table.PrimaryKey("PK_ForeignSettlementSecurity", x => x.ID);
  85. },
  86. comment: "SEIBro 종목별 외화증권 결제현황 (getSecnFrsecSetlInfo) — 특정 외화종목(ISIN) 매수/매도 결제신청수량·금액(USD). PROC_DT=T+1 반영");
  87. migrationBuilder.CreateIndex(
  88. name: "IX_ForeignCustodyNation_NationCd_StdDt",
  89. table: "ForeignCustodyNation",
  90. columns: new[] { "NationCd", "StdDt" });
  91. migrationBuilder.CreateIndex(
  92. name: "IX_ForeignCustodyNation_StdDt_NationCd_SecnTpcd",
  93. table: "ForeignCustodyNation",
  94. columns: new[] { "StdDt", "NationCd", "SecnTpcd" },
  95. unique: true);
  96. migrationBuilder.CreateIndex(
  97. name: "IX_ForeignCustodySecurity_Isin_StdDt",
  98. table: "ForeignCustodySecurity",
  99. columns: new[] { "Isin", "StdDt" });
  100. migrationBuilder.CreateIndex(
  101. name: "IX_ForeignCustodySecurity_StdDt_Isin",
  102. table: "ForeignCustodySecurity",
  103. columns: new[] { "StdDt", "Isin" },
  104. unique: true);
  105. migrationBuilder.CreateIndex(
  106. name: "IX_ForeignSettlementNation_NationCd_SetlDt",
  107. table: "ForeignSettlementNation",
  108. columns: new[] { "NationCd", "SetlDt" });
  109. migrationBuilder.CreateIndex(
  110. name: "IX_ForeignSettlementNation_SetlDt_NationCd_IntlBizCacd_SecnTpcd",
  111. table: "ForeignSettlementNation",
  112. columns: new[] { "SetlDt", "NationCd", "IntlBizCacd", "SecnTpcd" },
  113. unique: true);
  114. migrationBuilder.CreateIndex(
  115. name: "IX_ForeignSettlementSecurity_Isin_ProcDt",
  116. table: "ForeignSettlementSecurity",
  117. columns: new[] { "Isin", "ProcDt" });
  118. migrationBuilder.CreateIndex(
  119. name: "IX_ForeignSettlementSecurity_ProcDt_Isin_IntlBizCacd",
  120. table: "ForeignSettlementSecurity",
  121. columns: new[] { "ProcDt", "Isin", "IntlBizCacd" },
  122. unique: true);
  123. }
  124. /// <inheritdoc />
  125. protected override void Down(MigrationBuilder migrationBuilder)
  126. {
  127. migrationBuilder.DropTable(
  128. name: "ForeignCustodyNation");
  129. migrationBuilder.DropTable(
  130. name: "ForeignCustodySecurity");
  131. migrationBuilder.DropTable(
  132. name: "ForeignSettlementNation");
  133. migrationBuilder.DropTable(
  134. name: "ForeignSettlementSecurity");
  135. }
  136. }
  137. }