using Microsoft.EntityFrameworkCore.Migrations; namespace ProRestaurant.Migrations { public partial class MenuOptionsChange : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_MenuOptions_MenuCategories_CategoryId", table: "MenuOptions"); migrationBuilder.DropIndex( name: "IX_MenuOptions_CategoryId", table: "MenuOptions"); migrationBuilder.AlterColumn( name: "CategoryId", table: "MenuOptions", nullable: false, oldClrType: typeof(int), oldNullable: true); migrationBuilder.AddColumn( name: "MenuCategoryId", table: "MenuOptions", nullable: true); migrationBuilder.AddColumn( name: "RestaurantId", table: "MenuOptions", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "OutOfStock", table: "MenuItems", nullable: false, defaultValue: false); migrationBuilder.CreateIndex( name: "IX_MenuOptions_MenuCategoryId", table: "MenuOptions", column: "MenuCategoryId"); migrationBuilder.CreateIndex( name: "IX_MenuOptions_RestaurantId", table: "MenuOptions", column: "RestaurantId"); migrationBuilder.AddForeignKey( name: "FK_MenuOptions_MenuCategories_MenuCategoryId", table: "MenuOptions", column: "MenuCategoryId", principalTable: "MenuCategories", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_MenuOptions_Restaurants_RestaurantId", table: "MenuOptions", column: "RestaurantId", principalTable: "Restaurants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_MenuOptions_MenuCategories_MenuCategoryId", table: "MenuOptions"); migrationBuilder.DropForeignKey( name: "FK_MenuOptions_Restaurants_RestaurantId", table: "MenuOptions"); migrationBuilder.DropIndex( name: "IX_MenuOptions_MenuCategoryId", table: "MenuOptions"); migrationBuilder.DropIndex( name: "IX_MenuOptions_RestaurantId", table: "MenuOptions"); migrationBuilder.DropColumn( name: "MenuCategoryId", table: "MenuOptions"); migrationBuilder.DropColumn( name: "RestaurantId", table: "MenuOptions"); migrationBuilder.DropColumn( name: "OutOfStock", table: "MenuItems"); migrationBuilder.AlterColumn( name: "CategoryId", table: "MenuOptions", nullable: true, oldClrType: typeof(int)); migrationBuilder.CreateIndex( name: "IX_MenuOptions_CategoryId", table: "MenuOptions", column: "CategoryId"); migrationBuilder.AddForeignKey( name: "FK_MenuOptions_MenuCategories_CategoryId", table: "MenuOptions", column: "CategoryId", principalTable: "MenuCategories", principalColumn: "Id", onDelete: ReferentialAction.Restrict); } } }