using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace API.Migrations
{
    /// <inheritdoc />
    public partial class RemovedPreferedRecipes : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Users_PrefereredRecipes_PrefereredRecipesId",
                table: "Users");

            migrationBuilder.DropIndex(
                name: "IX_Users_PrefereredRecipesId",
                table: "Users");

            migrationBuilder.DropColumn(
                name: "PrefereredRecipesId",
                table: "Users");

            migrationBuilder.AddColumn<int>(
                name: "UserId",
                table: "Recipes",
                type: "int",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Recipes_UserId",
                table: "Recipes",
                column: "UserId");

            migrationBuilder.AddForeignKey(
                name: "FK_Recipes_Users_UserId",
                table: "Recipes",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_Recipes_UserId",
                table: "Recipes");

            migrationBuilder.DropColumn(
                name: "UserId",
                table: "Recipes");

            migrationBuilder.AddColumn<int>(
                name: "PrefereredRecipesId",
                table: "Users",
                type: "int",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Users_PrefereredRecipesId",
                table: "Users",
                column: "PrefereredRecipesId");

            migrationBuilder.AddForeignKey(
                name: "FK_Users_PrefereredRecipes_PrefereredRecipesId",
                table: "Users",
                column: "PrefereredRecipesId",
                principalTable: "PrefereredRecipes",
                principalColumn: "Id");
        }
    }
}