using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PARR.DAL.Migrations
{
    /// <inheritdoc />
    public partial class tblWorkGroupRespAreaCodeRequired : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_WorkGroups_ResponseAreas_ResponseAreaCode",
                table: "WorkGroups");

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

            migrationBuilder.AddForeignKey(
                name: "FK_WorkGroups_ResponseAreas_ResponseAreaCode",
                table: "WorkGroups",
                column: "ResponseAreaCode",
                principalTable: "ResponseAreas",
                principalColumn: "Code",
                onDelete: ReferentialAction.Cascade);
        }

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

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

            migrationBuilder.AddForeignKey(
                name: "FK_WorkGroups_ResponseAreas_ResponseAreaCode",
                table: "WorkGroups",
                column: "ResponseAreaCode",
                principalTable: "ResponseAreas",
                principalColumn: "Code");
        }
    }
}
