using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ComputerShopDatabaseImplement.Migrations { /// public partial class fix2 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Supplies_EquipmentReceivings_ReceivingId", table: "Supplies"); migrationBuilder.AlterColumn( name: "ReceivingId", table: "Supplies", type: "int", nullable: true, oldClrType: typeof(int), oldType: "int"); migrationBuilder.AddColumn( 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"); } /// 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( 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); } } }