using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class AddMacroData : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ExchangeRate", columns: table => new { ID = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CurrencyUnit = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "통화 코드 (cur_unit) — 예: USD, JPY(100)"), CurrencyName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "통화명 (cur_nm)"), TradeDate = table.Column(type: "date", nullable: false), DealBasRate = table.Column(type: "decimal(10,2)", precision: 10, scale: 2, nullable: false, comment: "매매기준율 (deal_bas_r)"), Ttb = table.Column(type: "decimal(10,2)", precision: 10, scale: 2, nullable: true, comment: "전신환 받으실 때 (ttb)"), Tts = table.Column(type: "decimal(10,2)", precision: 10, scale: 2, nullable: true, comment: "전신환 보내실 때 (tts)"), CreatedAt = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), RateType = table.Column(type: "tinyint", nullable: false, comment: "금리 종류 (1=대출금리, 2=국제금리)"), ItemName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "항목명 (cur_nm 등)"), TradeDate = table.Column(type: "date", nullable: false), Rate = table.Column(type: "decimal(9,4)", precision: 9, scale: 4, nullable: true, comment: "금리 % — 미고시 시 null"), CreatedAt = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ExchangeRate"); migrationBuilder.DropTable( name: "InterestRate"); } } }