using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Infrastructure.Migrations.AppDb
{
    /// <inheritdoc />
    public partial class AddMemberExpLog : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "MemberExpLog",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
                    Reason = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false, comment: "사유"),
                    Amount = table.Column<int>(type: "int", nullable: false, comment: "변동량"),
                    Balance = table.Column<long>(type: "bigint", nullable: false, comment: "잔액"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "기록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberExpLog", x => x.ID);
                    table.ForeignKey(
                        name: "FK_MemberExpLog_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "경험치 변동 내역");

            migrationBuilder.CreateIndex(
                name: "IX_MemberExpLog_MemberID",
                table: "MemberExpLog",
                column: "MemberID");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "MemberExpLog");
        }
    }
}
