using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Persistence.Migrations
{
///
public partial class a6 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AdminAccessLog",
columns: table => new
{
ID = table.Column(type: "bigint", nullable: false, comment: "PK")
.Annotation("SqlServer:Identity", "1, 1"),
UserID = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false, comment: "관리자 사용자 ID"),
UserName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "관리자 사용자 이름"),
Method = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false, comment: "HTTP Method"),
Path = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: false, comment: "요청 경로"),
QueryString = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: true, comment: "쿼리 스트링"),
StatusCode = table.Column(type: "int", nullable: false, comment: "응답 상태 코드"),
ElapsedMs = table.Column(type: "bigint", nullable: false, comment: "처리 시간 (밀리초)"),
MenuName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "메뉴 이름"),
IpAddress = table.Column(type: "nvarchar(45)", maxLength: 45, nullable: true, comment: "IP 주소"),
UserAgent = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
CreatedAt = table.Column(type: "datetime2", nullable: false, comment: "생성 일시")
},
constraints: table =>
{
table.PrimaryKey("PK_AdminAccessLog", x => x.ID);
},
comment: "관리자 접근 기록");
migrationBuilder.CreateTable(
name: "AdminLoginLog",
columns: table => new
{
ID = table.Column(type: "int", nullable: false, comment: "PK")
.Annotation("SqlServer:Identity", "1, 1"),
Success = table.Column(type: "bit", nullable: false, comment: "로그인 성공 여부"),
Account = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false, comment: "로그인 시도 계정"),
Reason = table.Column(type: "nvarchar(225)", maxLength: 225, nullable: true, comment: "실패 사유"),
IpAddress = table.Column(type: "nvarchar(45)", maxLength: 45, nullable: true, comment: "IP 주소"),
UserAgent = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
CreatedAt = table.Column(type: "datetime2", nullable: false, comment: "생성 일시")
},
constraints: table =>
{
table.PrimaryKey("PK_AdminLoginLog", x => x.ID);
},
comment: "관리자 로그인 기록");
migrationBuilder.CreateIndex(
name: "IX_AdminAccessLog_CreatedAt",
table: "AdminAccessLog",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_AdminAccessLog_UserID",
table: "AdminAccessLog",
column: "UserID");
migrationBuilder.CreateIndex(
name: "IX_AdminLoginLog_Account",
table: "AdminLoginLog",
column: "Account");
migrationBuilder.CreateIndex(
name: "IX_AdminLoginLog_CreatedAt",
table: "AdminLoginLog",
column: "CreatedAt");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AdminAccessLog");
migrationBuilder.DropTable(
name: "AdminLoginLog");
}
}
}