20260707093947_AddSeibroIssuerAndStockExtension.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddSeibroIssuerAndStockExtension : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AddColumn<decimal>(
  13. name: "FaceValue",
  14. table: "Stock",
  15. type: "decimal(15,4)",
  16. precision: 15,
  17. scale: 4,
  18. nullable: true,
  19. comment: "액면가 (SEIBro PVAL)");
  20. migrationBuilder.AddColumn<bool>(
  21. name: "IsElectronicSecurity",
  22. table: "Stock",
  23. type: "bit",
  24. nullable: true,
  25. comment: "전자증권 여부 (SEIBro ELTSC_YN)");
  26. migrationBuilder.AddColumn<int>(
  27. name: "IssucoCustno",
  28. table: "Stock",
  29. type: "int",
  30. nullable: true,
  31. comment: "SEIBro 발행회사 고객번호 (ISSUCO_CUSTNO) — 기업정보 API 조인키");
  32. migrationBuilder.AddColumn<long>(
  33. name: "TotalIssuedShares",
  34. table: "Stock",
  35. type: "bigint",
  36. nullable: true,
  37. comment: "총발행주식수 (SEIBro TOTAL_STK_CNT)");
  38. migrationBuilder.AddColumn<decimal>(
  39. name: "VotingRights",
  40. table: "Stock",
  41. type: "decimal(5,2)",
  42. precision: 5,
  43. scale: 2,
  44. nullable: true,
  45. comment: "1주당 의결권수 (SEIBro VOTRNO)");
  46. migrationBuilder.CreateTable(
  47. name: "SeibroIssuerCode",
  48. columns: table => new
  49. {
  50. ID = table.Column<int>(type: "int", nullable: false)
  51. .Annotation("SqlServer:Identity", "1, 1"),
  52. Market = table.Column<string>(type: "nchar(2)", fixedLength: true, maxLength: 2, nullable: false, comment: "시장구분 (MART_TPCD) — 11유가/12코스닥/13K-OTC/14코넥스/50기타"),
  53. ShortCode = table.Column<string>(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "단축코드 (SHOTN_ISIN)"),
  54. Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "종목명 (KOR_SECN_NM)"),
  55. IssucoCustno = table.Column<int>(type: "int", nullable: false, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
  56. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  57. },
  58. constraints: table =>
  59. {
  60. table.PrimaryKey("PK_SeibroIssuerCode", x => x.ID);
  61. },
  62. comment: "SEIBro 시장별 단축코드↔발행회사번호 매핑 (getShotnByMart)");
  63. migrationBuilder.CreateIndex(
  64. name: "IX_Stock_IssucoCustno",
  65. table: "Stock",
  66. column: "IssucoCustno");
  67. migrationBuilder.CreateIndex(
  68. name: "IX_SeibroIssuerCode_IssucoCustno",
  69. table: "SeibroIssuerCode",
  70. column: "IssucoCustno");
  71. migrationBuilder.CreateIndex(
  72. name: "IX_SeibroIssuerCode_Market_ShortCode",
  73. table: "SeibroIssuerCode",
  74. columns: new[] { "Market", "ShortCode" },
  75. unique: true);
  76. }
  77. /// <inheritdoc />
  78. protected override void Down(MigrationBuilder migrationBuilder)
  79. {
  80. migrationBuilder.DropTable(
  81. name: "SeibroIssuerCode");
  82. migrationBuilder.DropIndex(
  83. name: "IX_Stock_IssucoCustno",
  84. table: "Stock");
  85. migrationBuilder.DropColumn(
  86. name: "FaceValue",
  87. table: "Stock");
  88. migrationBuilder.DropColumn(
  89. name: "IsElectronicSecurity",
  90. table: "Stock");
  91. migrationBuilder.DropColumn(
  92. name: "IssucoCustno",
  93. table: "Stock");
  94. migrationBuilder.DropColumn(
  95. name: "TotalIssuedShares",
  96. table: "Stock");
  97. migrationBuilder.DropColumn(
  98. name: "VotingRights",
  99. table: "Stock");
  100. }
  101. }
  102. }