using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace RobotNet.RobotManager.Data.Migrations
{
    /// <inheritdoc />
    public partial class fixRobotDb : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Robots_RobotModels_MapId",
                table: "Robots");

            migrationBuilder.DropIndex(
                name: "IX_Robots_MapId",
                table: "Robots");

            migrationBuilder.CreateIndex(
                name: "IX_Robots_ModelId",
                table: "Robots",
                column: "ModelId");

            migrationBuilder.AddForeignKey(
                name: "FK_Robots_RobotModels_ModelId",
                table: "Robots",
                column: "ModelId",
                principalTable: "RobotModels",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

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

            migrationBuilder.DropIndex(
                name: "IX_Robots_ModelId",
                table: "Robots");

            migrationBuilder.CreateIndex(
                name: "IX_Robots_MapId",
                table: "Robots",
                column: "MapId");

            migrationBuilder.AddForeignKey(
                name: "FK_Robots_RobotModels_MapId",
                table: "Robots",
                column: "MapId",
                principalTable: "RobotModels",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
