20260708072448_AddWorldIndex.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddWorldIndex : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "WorldIndexSnapshot",
  14. columns: table => new
  15. {
  16. ID = table.Column<long>(type: "bigint", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. Symbol = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "외부 소스(Stooq) 심볼"),
  19. Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "지수 표시명"),
  20. CountryCode = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "국가 코드 (ISO2)"),
  21. ExchangeName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "거래소·시장 표기"),
  22. TradeDate = table.Column<DateOnly>(type: "date", nullable: false),
  23. Close = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "종가"),
  24. PrevClose = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "직전 거래일 종가"),
  25. ChangeVal = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "전일 대비"),
  26. FlucRateBp = table.Column<int>(type: "int", nullable: false, comment: "등락률 basis point (%×100)"),
  27. Open = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "시가"),
  28. High = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "고가"),
  29. Low = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "저가"),
  30. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  31. },
  32. constraints: table =>
  33. {
  34. table.PrimaryKey("PK_WorldIndexSnapshot", x => x.ID);
  35. },
  36. comment: "세계 주요국 증시지수 최신 스냅샷 (메인 세계지도 핀, 외부 소스 일1회 upsert)");
  37. migrationBuilder.CreateIndex(
  38. name: "IX_WorldIndexSnapshot_CountryCode",
  39. table: "WorldIndexSnapshot",
  40. column: "CountryCode");
  41. migrationBuilder.CreateIndex(
  42. name: "IX_WorldIndexSnapshot_Symbol",
  43. table: "WorldIndexSnapshot",
  44. column: "Symbol",
  45. unique: true);
  46. }
  47. /// <inheritdoc />
  48. protected override void Down(MigrationBuilder migrationBuilder)
  49. {
  50. migrationBuilder.DropTable(
  51. name: "WorldIndexSnapshot");
  52. }
  53. }
  54. }