easyeat/backend/API/Migrations/20250430092324_PreferedRecipesisnullable.cs
2025-04-30 11:36:05 +02:00

60 lines
1.9 KiB
C#

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);
}
}
}