90 lines
2.9 KiB
C#
90 lines
2.9 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ComputerShopDatabaseImplement.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class fix2 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Supplies_EquipmentReceivings_ReceivingId",
|
|
table: "Supplies");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "ReceivingId",
|
|
table: "Supplies",
|
|
type: "int",
|
|
nullable: true,
|
|
oldClrType: typeof(int),
|
|
oldType: "int");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "ComponentId",
|
|
table: "Supplies",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Supplies_ComponentId",
|
|
table: "Supplies",
|
|
column: "ComponentId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Supplies_Components_ComponentId",
|
|
table: "Supplies",
|
|
column: "ComponentId",
|
|
principalTable: "Components",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Supplies_EquipmentReceivings_ReceivingId",
|
|
table: "Supplies",
|
|
column: "ReceivingId",
|
|
principalTable: "EquipmentReceivings",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Supplies_Components_ComponentId",
|
|
table: "Supplies");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Supplies_EquipmentReceivings_ReceivingId",
|
|
table: "Supplies");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Supplies_ComponentId",
|
|
table: "Supplies");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ComponentId",
|
|
table: "Supplies");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "ReceivingId",
|
|
table: "Supplies",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0,
|
|
oldClrType: typeof(int),
|
|
oldType: "int",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Supplies_EquipmentReceivings_ReceivingId",
|
|
table: "Supplies",
|
|
column: "ReceivingId",
|
|
principalTable: "EquipmentReceivings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|