using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Brizco.Repository.Migrations
{
    /// <inheritdoc />
    public partial class editShiftPlan : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "PlanDate",
                schema: "public",
                table: "ShiftPlans",
                newName: "PlanFor");

            migrationBuilder.AddColumn<Guid>(
                name: "RoutineId",
                schema: "public",
                table: "ShiftPlans",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.CreateIndex(
                name: "IX_ShiftPlans_RoutineId",
                schema: "public",
                table: "ShiftPlans",
                column: "RoutineId");

            migrationBuilder.AddForeignKey(
                name: "FK_ShiftPlans_Routines_RoutineId",
                schema: "public",
                table: "ShiftPlans",
                column: "RoutineId",
                principalSchema: "public",
                principalTable: "Routines",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

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

            migrationBuilder.DropIndex(
                name: "IX_ShiftPlans_RoutineId",
                schema: "public",
                table: "ShiftPlans");

            migrationBuilder.DropColumn(
                name: "RoutineId",
                schema: "public",
                table: "ShiftPlans");

            migrationBuilder.RenameColumn(
                name: "PlanFor",
                schema: "public",
                table: "ShiftPlans",
                newName: "PlanDate");
        }
    }
}
