using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Brizco.Repository.Migrations
{
    /// <inheritdoc />
    public partial class editActivityAddShiftPlanId : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Tasks_Shifts_ShiftId",
                schema: "public",
                table: "Tasks");

            migrationBuilder.RenameColumn(
                name: "ShiftId",
                schema: "public",
                table: "Tasks",
                newName: "ShiftPlanId");

            migrationBuilder.RenameIndex(
                name: "IX_Tasks_ShiftId",
                schema: "public",
                table: "Tasks",
                newName: "IX_Tasks_ShiftPlanId");

            migrationBuilder.AddForeignKey(
                name: "FK_Tasks_ShiftPlans_ShiftPlanId",
                schema: "public",
                table: "Tasks",
                column: "ShiftPlanId",
                principalSchema: "public",
                principalTable: "ShiftPlans",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Tasks_ShiftPlans_ShiftPlanId",
                schema: "public",
                table: "Tasks");

            migrationBuilder.RenameColumn(
                name: "ShiftPlanId",
                schema: "public",
                table: "Tasks",
                newName: "ShiftId");

            migrationBuilder.RenameIndex(
                name: "IX_Tasks_ShiftPlanId",
                schema: "public",
                table: "Tasks",
                newName: "IX_Tasks_ShiftId");

            migrationBuilder.AddForeignKey(
                name: "FK_Tasks_Shifts_ShiftId",
                schema: "public",
                table: "Tasks",
                column: "ShiftId",
                principalSchema: "public",
                principalTable: "Shifts",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
