using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CartriX.Api.Migrations { /// public partial class Init4 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Cartridges_StatusCartridges_StautsId", table: "Cartridges"); migrationBuilder.DropForeignKey( name: "FK_CartridgeSupportedPrinters_Cartridges_SupportedCartridgeModelsId", table: "CartridgeSupportedPrinters"); migrationBuilder.DropForeignKey( name: "FK_CartridgeSupportedPrinters_Printers_SupportedPrinterModelsId", table: "CartridgeSupportedPrinters"); migrationBuilder.DropIndex( name: "IX_Cartridges_StautsId", table: "Cartridges"); migrationBuilder.DropPrimaryKey( name: "PK_CartridgeSupportedPrinters", table: "CartridgeSupportedPrinters"); migrationBuilder.DropColumn( name: "StautsId", table: "Cartridges"); migrationBuilder.RenameTable( name: "CartridgeSupportedPrinters", newName: "CartridgeCapabilityPrinters"); migrationBuilder.RenameColumn( name: "SupportedPrinterModelsId", table: "CartridgeCapabilityPrinters", newName: "SupportPrinterModelsId"); migrationBuilder.RenameColumn( name: "SupportedCartridgeModelsId", table: "CartridgeCapabilityPrinters", newName: "SupportCartridgeModelsId"); migrationBuilder.RenameIndex( name: "IX_CartridgeSupportedPrinters_SupportedPrinterModelsId", table: "CartridgeCapabilityPrinters", newName: "IX_CartridgeCapabilityPrinters_SupportPrinterModelsId"); migrationBuilder.AddPrimaryKey( name: "PK_CartridgeCapabilityPrinters", table: "CartridgeCapabilityPrinters", columns: new[] { "SupportCartridgeModelsId", "SupportPrinterModelsId" }); migrationBuilder.CreateIndex( name: "IX_Cartridges_StatusId", table: "Cartridges", column: "StatusId"); migrationBuilder.AddForeignKey( name: "FK_CartridgeCapabilityPrinters_Cartridges_SupportCartridgeModelsId", table: "CartridgeCapabilityPrinters", column: "SupportCartridgeModelsId", principalTable: "Cartridges", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_CartridgeCapabilityPrinters_Printers_SupportPrinterModelsId", table: "CartridgeCapabilityPrinters", column: "SupportPrinterModelsId", principalTable: "Printers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Cartridges_StatusCartridges_StatusId", table: "Cartridges", column: "StatusId", principalTable: "StatusCartridges", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_CartridgeCapabilityPrinters_Cartridges_SupportCartridgeModelsId", table: "CartridgeCapabilityPrinters"); migrationBuilder.DropForeignKey( name: "FK_CartridgeCapabilityPrinters_Printers_SupportPrinterModelsId", table: "CartridgeCapabilityPrinters"); migrationBuilder.DropForeignKey( name: "FK_Cartridges_StatusCartridges_StatusId", table: "Cartridges"); migrationBuilder.DropIndex( name: "IX_Cartridges_StatusId", table: "Cartridges"); migrationBuilder.DropPrimaryKey( name: "PK_CartridgeCapabilityPrinters", table: "CartridgeCapabilityPrinters"); migrationBuilder.RenameTable( name: "CartridgeCapabilityPrinters", newName: "CartridgeSupportedPrinters"); migrationBuilder.RenameColumn( name: "SupportPrinterModelsId", table: "CartridgeSupportedPrinters", newName: "SupportedPrinterModelsId"); migrationBuilder.RenameColumn( name: "SupportCartridgeModelsId", table: "CartridgeSupportedPrinters", newName: "SupportedCartridgeModelsId"); migrationBuilder.RenameIndex( name: "IX_CartridgeCapabilityPrinters_SupportPrinterModelsId", table: "CartridgeSupportedPrinters", newName: "IX_CartridgeSupportedPrinters_SupportedPrinterModelsId"); migrationBuilder.AddColumn( name: "StautsId", table: "Cartridges", type: "INTEGER", nullable: false, defaultValue: 0); migrationBuilder.AddPrimaryKey( name: "PK_CartridgeSupportedPrinters", table: "CartridgeSupportedPrinters", columns: new[] { "SupportedCartridgeModelsId", "SupportedPrinterModelsId" }); migrationBuilder.CreateIndex( name: "IX_Cartridges_StautsId", table: "Cartridges", column: "StautsId"); migrationBuilder.AddForeignKey( name: "FK_Cartridges_StatusCartridges_StautsId", table: "Cartridges", column: "StautsId", principalTable: "StatusCartridges", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_CartridgeSupportedPrinters_Cartridges_SupportedCartridgeModelsId", table: "CartridgeSupportedPrinters", column: "SupportedCartridgeModelsId", principalTable: "Cartridges", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_CartridgeSupportedPrinters_Printers_SupportedPrinterModelsId", table: "CartridgeSupportedPrinters", column: "SupportedPrinterModelsId", principalTable: "Printers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }