using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PARR.DAL.Migrations
{
    /// <inheritdoc />
    public partial class tblWorkGroupsAddRelToResponseArea : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "ResponseAreaCode",
                table: "WorkGroups",
                type: "integer",
                nullable: true);

            migrationBuilder.InsertData(
                table: "ResponseAreas",
                columns: new[] { "Code", "Name" },
                values: new object[] { 100, "ОБЩЕЕ" });

            migrationBuilder.CreateIndex(
                name: "IX_WorkGroups_ResponseAreaCode",
                table: "WorkGroups",
                column: "ResponseAreaCode");

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

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

            migrationBuilder.DropIndex(
                name: "IX_WorkGroups_ResponseAreaCode",
                table: "WorkGroups");

            migrationBuilder.DeleteData(
                table: "ResponseAreas",
                keyColumn: "Code",
                keyValue: 100);

            migrationBuilder.DropColumn(
                name: "ResponseAreaCode",
                table: "WorkGroups");
        }
    }
}
