using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

            migrationBuilder.AlterColumn<int>(
                name: "PrefereredRecipesId",
                table: "Users",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

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

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

            migrationBuilder.AlterColumn<int>(
                name: "PrefereredRecipesId",
                table: "Users",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

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