using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb;
///
public partial class AddChannelHandleHistory : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ChannelHandleHistory",
columns: table => new
{
ID = table.Column(type: "int", nullable: false, comment: "PK")
.Annotation("SqlServer:Identity", "1, 1"),
ChannelID = table.Column(type: "int", nullable: false, comment: "채널 ID"),
OldHandle = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false, comment: "이전 핸들"),
ChangedAt = table.Column(type: "datetime2", nullable: false, comment: "변경 일시")
},
constraints: table =>
{
table.PrimaryKey("PK_ChannelHandleHistory", x => x.ID);
table.ForeignKey(
name: "FK_ChannelHandleHistory_Channel_ChannelID",
column: x => x.ChannelID,
principalTable: "Channel",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
},
comment: "채널 핸들 변경 이력");
migrationBuilder.CreateIndex(
name: "IX_ChannelHandleHistory_ChannelID_ChangedAt",
table: "ChannelHandleHistory",
columns: new[] { "ChannelID", "ChangedAt" },
descending: new[] { false, true });
migrationBuilder.CreateIndex(
name: "IX_ChannelHandleHistory_OldHandle",
table: "ChannelHandleHistory",
column: "OldHandle");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ChannelHandleHistory");
}
}