| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class AddSeibroForeign : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "ForeignCustodyNation",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- StdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "기준일자 (STD_DT, 스탬핑)"),
- NationCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "국가코드 (NATION_CD, 스탬핑) — US/JP/HK/CN/E1 등 43종"),
- SecnTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "종목구분코드 (SECN_TPCD) — 71외화주식~78외화수익증권"),
- FrsecCusAmt = table.Column<decimal>(type: "decimal(24,2)", nullable: true, comment: "외화증권보관금액 (FRSEC_CUS_AMT) — USD"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ForeignCustodyNation", x => x.ID);
- },
- comment: "SEIBro 국가별 외화증권 보관현황 (getNationFrsecCusInfo) — KSD 보관 외화증권 보관금액(USD), 국가×종목구분별. 서학개미 추이 소스");
- migrationBuilder.CreateTable(
- name: "ForeignCustodySecurity",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- StdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "기준일자 (STD_DT, 스탬핑)"),
- Isin = table.Column<string>(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN, 스탬핑)"),
- NationCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "국가코드 (NATION_CD)"),
- SecnTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "종목구분코드 (SECN_TPCD) — 71외화주식~78외화수익증권"),
- FrsecTotHoldAmt = table.Column<decimal>(type: "decimal(24,2)", nullable: true, comment: "외화증권보유금액 (FRSEC_TOT_HOLD_AMT) — USD"),
- FrsecTotHoldQty = table.Column<decimal>(type: "decimal(28,6)", nullable: true, comment: "외화증권총보유수량 (FRSEC_TOT_HOLD_QTY)"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ForeignCustodySecurity", x => x.ID);
- },
- comment: "SEIBro 종목별 외화증권 보관현황 (getSecnFrsecCusInfo) — 특정 외화종목(ISIN) 보유금액(USD)·보유수량. ForeignIsins seed 시 활성");
- migrationBuilder.CreateTable(
- name: "ForeignSettlementNation",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- SetlDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "결제일자 (SETL_DT, 스탬핑)"),
- NationCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "국가코드 (NATION_CD, 스탬핑) — US/JP/HK/CN/E1 등 43종"),
- IntlBizCacd = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false, comment: "국제업무분류코드 (INTL_BIZ_CACD) — 1110매수 1120매도"),
- SecnTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "종목구분코드 (SECN_TPCD) — 71외화주식~78외화수익증권"),
- SetlCount = table.Column<long>(type: "bigint", nullable: true, comment: "결제건수 (SETL_COUNT)"),
- FrsecSetlAmt = table.Column<decimal>(type: "decimal(30,10)", nullable: true, comment: "외화증권결제금액 (FRSEC_SETL_AMT) — USD, NUMBER(26,10)"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ForeignSettlementNation", x => x.ID);
- },
- comment: "SEIBro 국가별 외화증권 결제현황 (getNationFrsecSetlInfo) — KSD 결제 매수/매도 결제건수·금액(USD), 국가×매매×종목구분별");
- migrationBuilder.CreateTable(
- name: "ForeignSettlementSecurity",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- ProcDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "결제처리일 (PROC_DT, 스탬핑, 한국시간) — 미국시간 T일 결제는 T+1 반영"),
- Isin = table.Column<string>(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "종목코드 (ISIN, 스탬핑)"),
- IntlBizCacd = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false, comment: "국제업무분류코드 (INTL_BIZ_CACD) — 1110매수 1120매도"),
- NationCd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "국가코드 (NATION_CD)"),
- SecnTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "종목구분코드 (SECN_TPCD) — 71외화주식~78외화수익증권"),
- SetlAskQty = table.Column<decimal>(type: "decimal(28,6)", nullable: true, comment: "결제신청수량 (SETL_ASK_QTY) — 주식:주, 채권:액면금액"),
- SetlAmt = table.Column<decimal>(type: "decimal(24,2)", nullable: true, comment: "결제금액 (SETL_AMT) — USD"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ForeignSettlementSecurity", x => x.ID);
- },
- comment: "SEIBro 종목별 외화증권 결제현황 (getSecnFrsecSetlInfo) — 특정 외화종목(ISIN) 매수/매도 결제신청수량·금액(USD). PROC_DT=T+1 반영");
- migrationBuilder.CreateIndex(
- name: "IX_ForeignCustodyNation_NationCd_StdDt",
- table: "ForeignCustodyNation",
- columns: new[] { "NationCd", "StdDt" });
- migrationBuilder.CreateIndex(
- name: "IX_ForeignCustodyNation_StdDt_NationCd_SecnTpcd",
- table: "ForeignCustodyNation",
- columns: new[] { "StdDt", "NationCd", "SecnTpcd" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_ForeignCustodySecurity_Isin_StdDt",
- table: "ForeignCustodySecurity",
- columns: new[] { "Isin", "StdDt" });
- migrationBuilder.CreateIndex(
- name: "IX_ForeignCustodySecurity_StdDt_Isin",
- table: "ForeignCustodySecurity",
- columns: new[] { "StdDt", "Isin" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_ForeignSettlementNation_NationCd_SetlDt",
- table: "ForeignSettlementNation",
- columns: new[] { "NationCd", "SetlDt" });
- migrationBuilder.CreateIndex(
- name: "IX_ForeignSettlementNation_SetlDt_NationCd_IntlBizCacd_SecnTpcd",
- table: "ForeignSettlementNation",
- columns: new[] { "SetlDt", "NationCd", "IntlBizCacd", "SecnTpcd" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_ForeignSettlementSecurity_Isin_ProcDt",
- table: "ForeignSettlementSecurity",
- columns: new[] { "Isin", "ProcDt" });
- migrationBuilder.CreateIndex(
- name: "IX_ForeignSettlementSecurity_ProcDt_Isin_IntlBizCacd",
- table: "ForeignSettlementSecurity",
- columns: new[] { "ProcDt", "Isin", "IntlBizCacd" },
- unique: true);
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "ForeignCustodyNation");
- migrationBuilder.DropTable(
- name: "ForeignCustodySecurity");
- migrationBuilder.DropTable(
- name: "ForeignSettlementNation");
- migrationBuilder.DropTable(
- name: "ForeignSettlementSecurity");
- }
- }
- }
|