| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class AddMacroData : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "ExchangeRate",
- columns: table => new
- {
- ID = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- CurrencyUnit = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "통화 코드 (cur_unit) — 예: USD, JPY(100)"),
- CurrencyName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "통화명 (cur_nm)"),
- TradeDate = table.Column<DateOnly>(type: "date", nullable: false),
- DealBasRate = table.Column<decimal>(type: "decimal(10,2)", precision: 10, scale: 2, nullable: false, comment: "매매기준율 (deal_bas_r)"),
- Ttb = table.Column<decimal>(type: "decimal(10,2)", precision: 10, scale: 2, nullable: true, comment: "전신환 받으실 때 (ttb)"),
- Tts = table.Column<decimal>(type: "decimal(10,2)", precision: 10, scale: 2, nullable: true, comment: "전신환 보내실 때 (tts)"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ExchangeRate", x => x.ID);
- },
- comment: "일별 환율 (한국수출입은행 OpenAPI AP01 현재환율)");
- migrationBuilder.CreateTable(
- name: "InterestRate",
- columns: table => new
- {
- ID = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- RateType = table.Column<byte>(type: "tinyint", nullable: false, comment: "금리 종류 (1=대출금리, 2=국제금리)"),
- ItemName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "항목명 (cur_nm 등)"),
- TradeDate = table.Column<DateOnly>(type: "date", nullable: false),
- Rate = table.Column<decimal>(type: "decimal(9,4)", precision: 9, scale: 4, nullable: true, comment: "금리 % — 미고시 시 null"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_InterestRate", x => x.ID);
- },
- comment: "일별 금리 (한국수출입은행 OpenAPI AP02 대출금리 / AP03 국제금리)");
- migrationBuilder.CreateIndex(
- name: "IX_ExchangeRate_CurrencyUnit_TradeDate",
- table: "ExchangeRate",
- columns: new[] { "CurrencyUnit", "TradeDate" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_ExchangeRate_TradeDate",
- table: "ExchangeRate",
- column: "TradeDate");
- migrationBuilder.CreateIndex(
- name: "IX_InterestRate_RateType_ItemName_TradeDate",
- table: "InterestRate",
- columns: new[] { "RateType", "ItemName", "TradeDate" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_InterestRate_TradeDate",
- table: "InterestRate",
- column: "TradeDate");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "ExchangeRate");
- migrationBuilder.DropTable(
- name: "InterestRate");
- }
- }
- }
|