using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb
{
///
public partial class AddStockWatch : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "StockWatch",
columns: table => new
{
ID = table.Column(type: "bigint", nullable: false, comment: "PK")
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false, comment: "관심 등록 회원 ID"),
StockCode = table.Column(type: "nchar(6)", fixedLength: true, maxLength: 6, nullable: false, comment: "단축코드 (char 6, Stock.Code denorm)"),
CreatedAt = table.Column(type: "datetime2", nullable: false, comment: "등록 일시")
},
constraints: table =>
{
table.PrimaryKey("PK_StockWatch", x => x.ID);
},
comment: "회원 관심종목");
migrationBuilder.CreateIndex(
name: "IX_StockWatch_MemberID_CreatedAt",
table: "StockWatch",
columns: new[] { "MemberID", "CreatedAt" },
descending: new[] { false, true });
migrationBuilder.CreateIndex(
name: "IX_StockWatch_MemberID_StockCode",
table: "StockWatch",
columns: new[] { "MemberID", "StockCode" },
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "StockWatch");
}
}
}