|
|
|
using System;
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Scp.WebApi.Migrations
|
|
|
|
{
|
|
|
|
public partial class _20211021001 : Migration
|
|
|
|
{
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
{
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
name: "WebApi_Part",
|
|
|
|
columns: table => new
|
|
|
|
{
|
|
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
|
Code = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Desc1 = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
|
|
|
|
Desc2 = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
|
|
|
|
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
IsMakePart = table.Column<bool>(type: "bit", nullable: false),
|
|
|
|
IsBuyPart = table.Column<bool>(type: "bit", nullable: false),
|
|
|
|
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
abcClass = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
productline = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
catalog = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Group = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Color = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Configuration = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Project = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Eco = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
StdPackUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
StdPackQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
ExtPackUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
ExtPackQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
Site = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Company = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
|
|
|
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
|
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
|
|
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
|
|
SequenceNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Version = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true)
|
|
|
|
},
|
|
|
|
constraints: table =>
|
|
|
|
{
|
|
|
|
table.PrimaryKey("PK_WebApi_Part", x => x.Id);
|
|
|
|
});
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
name: "WebApi_PO",
|
|
|
|
columns: table => new
|
|
|
|
{
|
|
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
|
PoNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
SupplierCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
PoType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
|
|
IsConsignment = table.Column<bool>(type: "bit", nullable: false),
|
|
|
|
OrderDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
DueDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
Version = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
TaxRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
Site = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Company = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
ContactName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
ContactPhone = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Remark = table.Column<string>(type: "nvarchar(max)", maxLength: 4096, nullable: true),
|
|
|
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
|
|
|
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
|
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
|
|
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
|
|
|
},
|
|
|
|
constraints: table =>
|
|
|
|
{
|
|
|
|
table.PrimaryKey("PK_WebApi_PO", x => x.Id);
|
|
|
|
});
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
name: "WebApi_Receipt",
|
|
|
|
columns: table => new
|
|
|
|
{
|
|
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
|
RcNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
AsnNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
RpNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
PoNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
SupplierCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
RcType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Warehouse = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Dock = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
TimeWindowBegin = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
TimeWindowEnd = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
ReceiveTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
Site = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Company = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
PoLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
PartCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Lot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
SupplierLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
ProductionDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
DeliverQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
ReceiveQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
StdPackUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
StdPackQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
SupplierPackUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
SupplierPackQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
SupplierPackConvertRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
Remark = table.Column<string>(type: "nvarchar(max)", maxLength: 4096, nullable: true),
|
|
|
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
|
|
|
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
|
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
|
|
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
|
|
|
},
|
|
|
|
constraints: table =>
|
|
|
|
{
|
|
|
|
table.PrimaryKey("PK_WebApi_Receipt", x => x.Id);
|
|
|
|
});
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
name: "WebApi_SupplierPart",
|
|
|
|
columns: table => new
|
|
|
|
{
|
|
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
|
SupplierCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
PartCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
SupplierPartCode = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
|
|
|
|
SupplierStdPackUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
SupplierStdPackQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
Remark = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
|
|
|
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
|
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
|
|
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
|
|
|
},
|
|
|
|
constraints: table =>
|
|
|
|
{
|
|
|
|
table.PrimaryKey("PK_WebApi_SupplierPart", x => x.Id);
|
|
|
|
});
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
name: "WebApi_Suppliers",
|
|
|
|
columns: table => new
|
|
|
|
{
|
|
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
|
Code = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Desc = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
|
|
|
|
Rank = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Address = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
|
|
|
|
Country = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
City = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Phone = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Fax = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
PostId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
ContactName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Currency = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
|
|
|
Company = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
Remark = table.Column<string>(type: "nvarchar(max)", maxLength: 4096, nullable: true),
|
|
|
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
|
|
|
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
|
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
|
|
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
|
|
|
},
|
|
|
|
constraints: table =>
|
|
|
|
{
|
|
|
|
table.PrimaryKey("PK_WebApi_Suppliers", x => x.Id);
|
|
|
|
});
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
name: "WebApi_PODetail",
|
|
|
|
columns: table => new
|
|
|
|
{
|
|
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
|
PoNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
PoLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
PartCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
OrderQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
StdPackUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
|
|
StdPackQty = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
|
|
SupplierPackUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|
|
|
SupplierPackQty = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
|
|
SupplierPackConvertRate = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
|
|
IsConsignment = table.Column<bool>(type: "bit", nullable: false),
|
|
|
|
LineStatus = table.Column<int>(type: "int", nullable: false),
|
|
|
|
Remark = table.Column<string>(type: "nvarchar(max)", maxLength: 4096, nullable: true),
|
|
|
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
|
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
|
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
|
|
|
},
|
|
|
|
constraints: table =>
|
|
|
|
{
|
|
|
|
table.PrimaryKey("PK_WebApi_PODetail", x => x.Id);
|
|
|
|
table.ForeignKey(
|
|
|
|
name: "FK_WebApi_PODetail_WebApi_PO_Id",
|
|
|
|
column: x => x.Id,
|
|
|
|
principalTable: "WebApi_PO",
|
|
|
|
principalColumn: "Id");
|
|
|
|
});
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
name: "IX_WebApi_Part_Code",
|
|
|
|
table: "WebApi_Part",
|
|
|
|
column: "Code",
|
|
|
|
unique: true,
|
|
|
|
filter: "IsDeleted=0");
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
name: "IX_WebApi_PO_PoNumber",
|
|
|
|
table: "WebApi_PO",
|
|
|
|
column: "PoNumber",
|
|
|
|
unique: true,
|
|
|
|
filter: "IsDeleted=0");
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
name: "IX_WebApi_PODetail_PoNumber_PoLine",
|
|
|
|
table: "WebApi_PODetail",
|
|
|
|
columns: new[] { "PoNumber", "PoLine" },
|
|
|
|
unique: true);
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
name: "IX_WebApi_Receipt_RcNumber_PoLine_PartCode",
|
|
|
|
table: "WebApi_Receipt",
|
|
|
|
columns: new[] { "RcNumber", "PoLine", "PartCode" },
|
|
|
|
unique: true,
|
|
|
|
filter: "IsDeleted=0");
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
name: "IX_WebApi_SupplierPart_SupplierCode_PartCode",
|
|
|
|
table: "WebApi_SupplierPart",
|
|
|
|
columns: new[] { "SupplierCode", "PartCode" },
|
|
|
|
unique: true,
|
|
|
|
filter: "IsDeleted=0");
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
name: "IX_WebApi_Suppliers_CreationTime",
|
|
|
|
table: "WebApi_Suppliers",
|
|
|
|
column: "CreationTime");
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
{
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
name: "WebApi_Part");
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
name: "WebApi_PODetail");
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
name: "WebApi_Receipt");
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
name: "WebApi_SupplierPart");
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
name: "WebApi_Suppliers");
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
name: "WebApi_PO");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|