using System; using Microsoft.EntityFrameworkCore.Migrations; namespace Win_in.Sfs.Basedata.Migrations { public partial class rebuildProdLineItem : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Basedata_ProdLineItem_Basedata_ProductionLine_ProdLineAggregateRootId", table: "Basedata_ProdLineItem"); migrationBuilder.DropIndex( name: "IX_Basedata_ProdLineItem_ProdLineAggregateRootId", table: "Basedata_ProdLineItem"); migrationBuilder.DropIndex( name: "IX_Basedata_ProdLineItem_ProdLineId_ItemId_BomId_RoutingId_Company", table: "Basedata_ProdLineItem"); migrationBuilder.DropColumn( name: "BomId", table: "Basedata_ProdLineItem"); migrationBuilder.DropColumn( name: "ItemId", table: "Basedata_ProdLineItem"); migrationBuilder.DropColumn( name: "ProdLineAggregateRootId", table: "Basedata_ProdLineItem"); migrationBuilder.DropColumn( name: "ProdLineId", table: "Basedata_ProdLineItem"); migrationBuilder.DropColumn( name: "RoutingId", table: "Basedata_ProdLineItem"); migrationBuilder.RenameColumn( name: "Locationcode", table: "Basedata_CustomerAddress", newName: "LocationCode"); migrationBuilder.AlterColumn( name: "IsActive", table: "Basedata_Supplier", type: "bit", nullable: false, defaultValue: true, oldClrType: typeof(bool), oldType: "bit"); migrationBuilder.AddColumn( name: "ItemCode", table: "Basedata_ProdLineItem", type: "nvarchar(450)", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "ProdLineCode", table: "Basedata_ProdLineItem", type: "nvarchar(450)", nullable: false, defaultValue: ""); migrationBuilder.CreateIndex( name: "IX_Basedata_ProdLineItem_ProdLineCode_ItemCode_Company", table: "Basedata_ProdLineItem", columns: new[] { "ProdLineCode", "ItemCode", "Company" }, unique: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_Basedata_ProdLineItem_ProdLineCode_ItemCode_Company", table: "Basedata_ProdLineItem"); migrationBuilder.DropColumn( name: "ItemCode", table: "Basedata_ProdLineItem"); migrationBuilder.DropColumn( name: "ProdLineCode", table: "Basedata_ProdLineItem"); migrationBuilder.RenameColumn( name: "LocationCode", table: "Basedata_CustomerAddress", newName: "Locationcode"); migrationBuilder.AlterColumn( name: "IsActive", table: "Basedata_Supplier", type: "bit", nullable: false, oldClrType: typeof(bool), oldType: "bit", oldDefaultValue: true); migrationBuilder.AddColumn( name: "BomId", table: "Basedata_ProdLineItem", type: "uniqueidentifier", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); migrationBuilder.AddColumn( name: "ItemId", table: "Basedata_ProdLineItem", type: "uniqueidentifier", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); migrationBuilder.AddColumn( name: "ProdLineAggregateRootId", table: "Basedata_ProdLineItem", type: "uniqueidentifier", nullable: true); migrationBuilder.AddColumn( name: "ProdLineId", table: "Basedata_ProdLineItem", type: "uniqueidentifier", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); migrationBuilder.AddColumn( name: "RoutingId", table: "Basedata_ProdLineItem", type: "uniqueidentifier", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); migrationBuilder.CreateIndex( name: "IX_Basedata_ProdLineItem_ProdLineAggregateRootId", table: "Basedata_ProdLineItem", column: "ProdLineAggregateRootId"); migrationBuilder.CreateIndex( name: "IX_Basedata_ProdLineItem_ProdLineId_ItemId_BomId_RoutingId_Company", table: "Basedata_ProdLineItem", columns: new[] { "ProdLineId", "ItemId", "BomId", "RoutingId", "Company" }, unique: true); migrationBuilder.AddForeignKey( name: "FK_Basedata_ProdLineItem_Basedata_ProductionLine_ProdLineAggregateRootId", table: "Basedata_ProdLineItem", column: "ProdLineAggregateRootId", principalTable: "Basedata_ProductionLine", principalColumn: "Id", onDelete: ReferentialAction.Restrict); } } }