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(type: "uniqueidentifier", nullable: false), Code = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Desc1 = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true), Desc2 = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true), Status = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), IsMakePart = table.Column(type: "bit", nullable: false), IsBuyPart = table.Column(type: "bit", nullable: false), Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), abcClass = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), productline = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Type = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), catalog = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Group = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Color = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Configuration = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Project = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Eco = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), StdPackUom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), StdPackQty = table.Column(type: "decimal(18,2)", nullable: false), ExtPackUom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), ExtPackQty = table.Column(type: "decimal(18,2)", nullable: false), Site = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Company = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), DeleterId = table.Column(type: "uniqueidentifier", nullable: true), DeletionTime = table.Column(type: "datetime2", nullable: true), SequenceNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Version = table.Column(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(type: "uniqueidentifier", nullable: false), PoNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), SupplierCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PoType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Status = table.Column(type: "int", nullable: false), IsConsignment = table.Column(type: "bit", nullable: false), OrderDate = table.Column(type: "datetime2", nullable: false), DueDate = table.Column(type: "datetime2", nullable: false), Version = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), TaxRate = table.Column(type: "decimal(18,2)", nullable: false), Site = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Company = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), ContactName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), ContactPhone = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Remark = table.Column(type: "nvarchar(max)", maxLength: 4096, nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), DeleterId = table.Column(type: "uniqueidentifier", nullable: true), DeletionTime = table.Column(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(type: "uniqueidentifier", nullable: false), RcNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), AsnNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), RpNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PoNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), SupplierCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), RcType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Warehouse = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Dock = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), TimeWindowBegin = table.Column(type: "datetime2", nullable: false), TimeWindowEnd = table.Column(type: "datetime2", nullable: false), ReceiveTime = table.Column(type: "datetime2", nullable: false), Site = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Company = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PoLine = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PartCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Lot = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), SupplierLot = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), ProductionDate = table.Column(type: "datetime2", nullable: false), Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), DeliverQty = table.Column(type: "decimal(18,2)", nullable: false), ReceiveQty = table.Column(type: "decimal(18,2)", nullable: false), StdPackUom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), StdPackQty = table.Column(type: "decimal(18,2)", nullable: false), SupplierPackUom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), SupplierPackQty = table.Column(type: "decimal(18,2)", nullable: false), SupplierPackConvertRate = table.Column(type: "decimal(18,2)", nullable: false), Remark = table.Column(type: "nvarchar(max)", maxLength: 4096, nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), DeleterId = table.Column(type: "uniqueidentifier", nullable: true), DeletionTime = table.Column(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(type: "uniqueidentifier", nullable: false), SupplierCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PartCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), SupplierPartCode = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true), SupplierStdPackUom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), SupplierStdPackQty = table.Column(type: "decimal(18,2)", nullable: false), Remark = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), DeleterId = table.Column(type: "uniqueidentifier", nullable: true), DeletionTime = table.Column(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(type: "uniqueidentifier", nullable: false), Code = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Desc = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true), Rank = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Address = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true), Country = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), City = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Phone = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Fax = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), PostId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), ContactName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Currency = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), IsActive = table.Column(type: "bit", nullable: false), Company = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Remark = table.Column(type: "nvarchar(max)", maxLength: 4096, nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), DeleterId = table.Column(type: "uniqueidentifier", nullable: true), DeletionTime = table.Column(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(type: "uniqueidentifier", nullable: false), PoNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PoLine = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PartCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), OrderQty = table.Column(type: "decimal(18,2)", nullable: false), StdPackUom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), StdPackQty = table.Column(type: "decimal(18,2)", nullable: false), SupplierPackUom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), SupplierPackQty = table.Column(type: "decimal(18,2)", nullable: true), SupplierPackConvertRate = table.Column(type: "decimal(18,2)", nullable: true), IsConsignment = table.Column(type: "bit", nullable: false), LineStatus = table.Column(type: "int", nullable: false), Remark = table.Column(type: "nvarchar(max)", maxLength: 4096, nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierId = table.Column(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"); } } }