using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Infrastructure.Migrations.AppDb
{
    /// <inheritdoc />
    public partial class PostMemberIdNullable : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Post_Member_MemberID",
                table: "Post");

            migrationBuilder.AlterColumn<int>(
                name: "MemberID",
                table: "Post",
                type: "int",
                nullable: true,
                comment: "회원 ID",
                oldClrType: typeof(int),
                oldType: "int",
                oldComment: "회원 ID");

            migrationBuilder.AddForeignKey(
                name: "FK_Post_Member_MemberID",
                table: "Post",
                column: "MemberID",
                principalTable: "Member",
                principalColumn: "ID",
                onDelete: ReferentialAction.SetNull);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Post_Member_MemberID",
                table: "Post");

            migrationBuilder.AlterColumn<int>(
                name: "MemberID",
                table: "Post",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "회원 ID",
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true,
                oldComment: "회원 ID");

            migrationBuilder.AddForeignKey(
                name: "FK_Post_Member_MemberID",
                table: "Post",
                column: "MemberID",
                principalTable: "Member",
                principalColumn: "ID",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
