CourseWork_Hotel/Hotel/HotelDataBaseImplement/Migrations/20230517064309_NullMealPlanId.cs

60 lines
1.8 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HotelDataBaseImplement.Migrations
{
/// <inheritdoc />
public partial class NullMealPlanId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Rooms_MealPlans_MealPlanId",
table: "Rooms");
migrationBuilder.AlterColumn<int>(
name: "MealPlanId",
table: "Rooms",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddForeignKey(
name: "FK_Rooms_MealPlans_MealPlanId",
table: "Rooms",
column: "MealPlanId",
principalTable: "MealPlans",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Rooms_MealPlans_MealPlanId",
table: "Rooms");
migrationBuilder.AlterColumn<int>(
name: "MealPlanId",
table: "Rooms",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Rooms_MealPlans_MealPlanId",
table: "Rooms",
column: "MealPlanId",
principalTable: "MealPlans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}