You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
159 lines
5.8 KiB
159 lines
5.8 KiB
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<bool>(
|
|
name: "IsActive",
|
|
table: "Basedata_Supplier",
|
|
type: "bit",
|
|
nullable: false,
|
|
defaultValue: true,
|
|
oldClrType: typeof(bool),
|
|
oldType: "bit");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ItemCode",
|
|
table: "Basedata_ProdLineItem",
|
|
type: "nvarchar(450)",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
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<bool>(
|
|
name: "IsActive",
|
|
table: "Basedata_Supplier",
|
|
type: "bit",
|
|
nullable: false,
|
|
oldClrType: typeof(bool),
|
|
oldType: "bit",
|
|
oldDefaultValue: true);
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "BomId",
|
|
table: "Basedata_ProdLineItem",
|
|
type: "uniqueidentifier",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "ItemId",
|
|
table: "Basedata_ProdLineItem",
|
|
type: "uniqueidentifier",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "ProdLineAggregateRootId",
|
|
table: "Basedata_ProdLineItem",
|
|
type: "uniqueidentifier",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "ProdLineId",
|
|
table: "Basedata_ProdLineItem",
|
|
type: "uniqueidentifier",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
|