20260706060620_AddDisclosure.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddDisclosure : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "Disclosure",
  14. columns: table => new
  15. {
  16. ID = table.Column<long>(type: "bigint", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. RceptNo = table.Column<string>(type: "nvarchar(14)", maxLength: 14, nullable: false, comment: "접수번호 (rcept_no, 14자리)"),
  19. CorpCode = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: false, comment: "고유번호 (corp_code, 8자리)"),
  20. CorpName = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false, comment: "법인명 (corp_name)"),
  21. StockCode = table.Column<string>(type: "nvarchar(6)", maxLength: 6, nullable: true, comment: "종목코드 (stock_code, 6자리) — 비상장이면 null"),
  22. CorpCls = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false, comment: "법인구분 (corp_cls, Y유가/K코스닥/N코넥스/E기타)"),
  23. ReportNm = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false, comment: "보고서명 (report_nm)"),
  24. FlrNm = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false, comment: "공시 제출인명 (flr_nm)"),
  25. RceptDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "접수일자 (rcept_dt)"),
  26. Rm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "비고 (rm)"),
  27. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  28. },
  29. constraints: table =>
  30. {
  31. table.PrimaryKey("PK_Disclosure", x => x.ID);
  32. },
  33. comment: "전자공시(DART) 공시 목록 (OpenDART list.json)");
  34. migrationBuilder.CreateIndex(
  35. name: "IX_Disclosure_RceptDt",
  36. table: "Disclosure",
  37. column: "RceptDt",
  38. descending: new bool[0]);
  39. migrationBuilder.CreateIndex(
  40. name: "IX_Disclosure_RceptNo",
  41. table: "Disclosure",
  42. column: "RceptNo",
  43. unique: true);
  44. migrationBuilder.CreateIndex(
  45. name: "IX_Disclosure_StockCode_RceptDt",
  46. table: "Disclosure",
  47. columns: new[] { "StockCode", "RceptDt" },
  48. descending: new[] { false, true });
  49. }
  50. /// <inheritdoc />
  51. protected override void Down(MigrationBuilder migrationBuilder)
  52. {
  53. migrationBuilder.DropTable(
  54. name: "Disclosure");
  55. }
  56. }
  57. }