ISEbd-21_Agliullov.D.A._Con.../ConfectioneryDatabaseImplement/Migrations/20230228204422_create_shop1.cs

113 lines
3.7 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ConfectioneryDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class create_shop1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ShopPastry_Pastries_PastryId",
table: "ShopPastry");
migrationBuilder.DropForeignKey(
name: "FK_ShopPastry_Shops_ShopId",
table: "ShopPastry");
migrationBuilder.DropPrimaryKey(
name: "PK_ShopPastry",
table: "ShopPastry");
migrationBuilder.RenameTable(
name: "ShopPastry",
newName: "ShopPastries");
migrationBuilder.RenameIndex(
name: "IX_ShopPastry_ShopId",
table: "ShopPastries",
newName: "IX_ShopPastries_ShopId");
migrationBuilder.RenameIndex(
name: "IX_ShopPastry_PastryId",
table: "ShopPastries",
newName: "IX_ShopPastries_PastryId");
migrationBuilder.AddPrimaryKey(
name: "PK_ShopPastries",
table: "ShopPastries",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ShopPastries_Pastries_PastryId",
table: "ShopPastries",
column: "PastryId",
principalTable: "Pastries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ShopPastries_Shops_ShopId",
table: "ShopPastries",
column: "ShopId",
principalTable: "Shops",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ShopPastries_Pastries_PastryId",
table: "ShopPastries");
migrationBuilder.DropForeignKey(
name: "FK_ShopPastries_Shops_ShopId",
table: "ShopPastries");
migrationBuilder.DropPrimaryKey(
name: "PK_ShopPastries",
table: "ShopPastries");
migrationBuilder.RenameTable(
name: "ShopPastries",
newName: "ShopPastry");
migrationBuilder.RenameIndex(
name: "IX_ShopPastries_ShopId",
table: "ShopPastry",
newName: "IX_ShopPastry_ShopId");
migrationBuilder.RenameIndex(
name: "IX_ShopPastries_PastryId",
table: "ShopPastry",
newName: "IX_ShopPastry_PastryId");
migrationBuilder.AddPrimaryKey(
name: "PK_ShopPastry",
table: "ShopPastry",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ShopPastry_Pastries_PastryId",
table: "ShopPastry",
column: "PastryId",
principalTable: "Pastries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ShopPastry_Shops_ShopId",
table: "ShopPastry",
column: "ShopId",
principalTable: "Shops",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}