105 lines
3.5 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ComputerShopDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class component : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AssemblyOrders_Assemblies_AssemblyId",
table: "AssemblyOrders");
migrationBuilder.DropForeignKey(
name: "FK_Supplies_Components_ComponentId",
table: "Supplies");
migrationBuilder.RenameColumn(
name: "ComponentId",
table: "Supplies",
newName: "OrderId");
migrationBuilder.RenameIndex(
name: "IX_Supplies_ComponentId",
table: "Supplies",
newName: "IX_Supplies_OrderId");
migrationBuilder.RenameColumn(
name: "AssemblyId",
table: "AssemblyOrders",
newName: "ComponentId");
migrationBuilder.RenameIndex(
name: "IX_AssemblyOrders_AssemblyId",
table: "AssemblyOrders",
newName: "IX_AssemblyOrders_ComponentId");
migrationBuilder.AddForeignKey(
name: "FK_AssemblyOrders_Components_ComponentId",
table: "AssemblyOrders",
column: "ComponentId",
principalTable: "Components",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Supplies_Orders_OrderId",
table: "Supplies",
column: "OrderId",
principalTable: "Orders",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AssemblyOrders_Components_ComponentId",
table: "AssemblyOrders");
migrationBuilder.DropForeignKey(
name: "FK_Supplies_Orders_OrderId",
table: "Supplies");
migrationBuilder.RenameColumn(
name: "OrderId",
table: "Supplies",
newName: "ComponentId");
migrationBuilder.RenameIndex(
name: "IX_Supplies_OrderId",
table: "Supplies",
newName: "IX_Supplies_ComponentId");
migrationBuilder.RenameColumn(
name: "ComponentId",
table: "AssemblyOrders",
newName: "AssemblyId");
migrationBuilder.RenameIndex(
name: "IX_AssemblyOrders_ComponentId",
table: "AssemblyOrders",
newName: "IX_AssemblyOrders_AssemblyId");
migrationBuilder.AddForeignKey(
name: "FK_AssemblyOrders_Assemblies_AssemblyId",
table: "AssemblyOrders",
column: "AssemblyId",
principalTable: "Assemblies",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Supplies_Components_ComponentId",
table: "Supplies",
column: "ComponentId",
principalTable: "Components",
principalColumn: "Id");
}
}
}