using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace CaseAccountingDataBaseImplement.Migrations
{
    /// <inheritdoc />
    public partial class migrSpecializationNullAttempt2 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Lawyers_Specializations_SpecializationId",
                table: "Lawyers");

            migrationBuilder.AlterColumn<int>(
                name: "SpecializationId",
                table: "Lawyers",
                type: "integer",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "integer");

            migrationBuilder.AddForeignKey(
                name: "FK_Lawyers_Specializations_SpecializationId",
                table: "Lawyers",
                column: "SpecializationId",
                principalTable: "Specializations",
                principalColumn: "Id");
        }

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

            migrationBuilder.AlterColumn<int>(
                name: "SpecializationId",
                table: "Lawyers",
                type: "integer",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "integer",
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_Lawyers_Specializations_SpecializationId",
                table: "Lawyers",
                column: "SpecializationId",
                principalTable: "Specializations",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
