| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class AddMarketQuoteSnapshot : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "MarketQuoteSnapshot",
- columns: table => new
- {
- ID = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Symbol = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false, comment: "외부 소스(Stooq) 심볼"),
- Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "표시명"),
- Category = table.Column<int>(type: "int", nullable: false, comment: "0 Stock,1 Commodity,2 Futures,3 Fx,4 BondYield"),
- GroupCode = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false, comment: "프론트 그룹 키"),
- CountryCode = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "국가 코드 (ISO2, 상품은 빈값)"),
- TradeDate = table.Column<DateOnly>(type: "date", nullable: false),
- Close = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "종가"),
- PrevClose = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "직전 거래일 종가"),
- ChangeVal = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "전일 대비"),
- FlucRateBp = table.Column<int>(type: "int", nullable: false, comment: "등락률 basis point (%×100)"),
- Open = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "시가"),
- High = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "고가"),
- Low = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, comment: "저가"),
- Volume = table.Column<long>(type: "bigint", nullable: false, comment: "거래량"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_MarketQuoteSnapshot", x => x.ID);
- },
- comment: "주요 종목·상품 시세 최신 스냅샷 (Stooq 일1회 upsert, 카테고리/그룹별)");
- migrationBuilder.CreateIndex(
- name: "IX_MarketQuoteSnapshot_Category_GroupCode",
- table: "MarketQuoteSnapshot",
- columns: new[] { "Category", "GroupCode" });
- migrationBuilder.CreateIndex(
- name: "IX_MarketQuoteSnapshot_Symbol",
- table: "MarketQuoteSnapshot",
- column: "Symbol",
- unique: true);
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "MarketQuoteSnapshot");
- }
- }
- }
|