using System; using Microsoft.EntityFrameworkCore.Migrations; namespace Win_in.Sfs.Wms.Job.Migrations { public partial class jisDeliverJob20220729 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "JobMesDeliverJobDetail"); migrationBuilder.DropTable( name: "JobMesDeliverJob"); migrationBuilder.CreateTable( name: "JobJisDeliverJob", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), Customer = table.Column(type: "nvarchar(max)", nullable: true), CustomerAddressCode = table.Column(type: "nvarchar(max)", nullable: true), CustomerLocationCode = table.Column(type: "nvarchar(max)", nullable: true), CustomerWarehouseCode = table.Column(type: "nvarchar(max)", nullable: true), ProjectCode = table.Column(type: "nvarchar(max)", nullable: true), PlanTime = table.Column(type: "datetime2", nullable: false), ContainerQty = table.Column(type: "decimal(18,2)", nullable: false), ItemQty = table.Column(type: "decimal(18,2)", 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), TenantId = table.Column(type: "uniqueidentifier", nullable: true), Remark = table.Column(type: "nvarchar(max)", maxLength: 4096, nullable: true), Company = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Worker = table.Column(type: "nvarchar(max)", nullable: true), WarehouseCode = table.Column(type: "nvarchar(max)", nullable: true), Number = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), UpStreamJobNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), JobDescription = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true), JobType = table.Column(type: "int", nullable: false), JobStatus = table.Column(type: "int", nullable: false), Priority = table.Column(type: "int", nullable: false, defaultValue: 0), PriorityIncrement = table.Column(type: "int", nullable: false, defaultValue: 0), WorkGroupCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), IsAutoComplete = table.Column(type: "bit", nullable: false, defaultValue: false), AcceptUserId = table.Column(type: "uniqueidentifier", nullable: true), AcceptUserName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), AcceptTime = table.Column(type: "datetime2", nullable: true), CompleteUserId = table.Column(type: "uniqueidentifier", nullable: true), CompleteUserName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), CompleteTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_JobJisDeliverJob", x => x.Id); }); migrationBuilder.CreateTable( name: "JobJisDeliverJobDetail", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ContainerCode = table.Column(type: "nvarchar(max)", nullable: true), ContainerName = table.Column(type: "nvarchar(max)", nullable: true), ContainerDesc = table.Column(type: "nvarchar(max)", nullable: true), InventoryCount = table.Column(type: "decimal(18,2)", nullable: false), FromLocationCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), ToLocationCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Status = table.Column(type: "int", nullable: false), 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), MasterID = table.Column(type: "uniqueidentifier", nullable: false), TenantId = table.Column(type: "uniqueidentifier", nullable: true), Number = table.Column(type: "nvarchar(max)", nullable: true), Remark = table.Column(type: "nvarchar(max)", maxLength: 4096, nullable: true) }, constraints: table => { table.PrimaryKey("PK_JobJisDeliverJobDetail", x => x.Id); table.ForeignKey( name: "FK_JobJisDeliverJobDetail_JobJisDeliverJob_MasterID", column: x => x.MasterID, principalTable: "JobJisDeliverJob", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_JobJisDeliverJob_Company_Number", table: "JobJisDeliverJob", columns: new[] { "Company", "Number" }, unique: true); migrationBuilder.CreateIndex( name: "IX_JobJisDeliverJobDetail_MasterID", table: "JobJisDeliverJobDetail", column: "MasterID"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "JobJisDeliverJobDetail"); migrationBuilder.DropTable( name: "JobJisDeliverJob"); migrationBuilder.CreateTable( name: "JobMesDeliverJob", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), AcceptTime = table.Column(type: "datetime2", nullable: true), AcceptUserId = table.Column(type: "uniqueidentifier", nullable: true), AcceptUserName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Company = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), CompleteTime = table.Column(type: "datetime2", nullable: true), CompleteUserId = table.Column(type: "uniqueidentifier", nullable: true), CompleteUserName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), ContainerQty = table.Column(type: "decimal(18,2)", nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), Customer = table.Column(type: "nvarchar(max)", nullable: true), CustomerAddressCode = table.Column(type: "nvarchar(max)", nullable: true), CustomerLocationCode = table.Column(type: "nvarchar(max)", nullable: true), CustomerWarehouseCode = table.Column(type: "nvarchar(max)", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), IsAutoComplete = table.Column(type: "bit", nullable: false, defaultValue: false), ItemQty = table.Column(type: "decimal(18,2)", nullable: false), JobDescription = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true), JobStatus = table.Column(type: "int", nullable: false), JobType = table.Column(type: "int", nullable: false), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), Number = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PlanTime = table.Column(type: "datetime2", nullable: false), Priority = table.Column(type: "int", nullable: false, defaultValue: 0), PriorityIncrement = table.Column(type: "int", nullable: false, defaultValue: 0), ProjectCode = table.Column(type: "nvarchar(max)", nullable: true), Remark = table.Column(type: "nvarchar(max)", maxLength: 4096, nullable: true), TenantId = table.Column(type: "uniqueidentifier", nullable: true), UpStreamJobNumber = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), WarehouseCode = table.Column(type: "nvarchar(max)", nullable: true), WorkGroupCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), Worker = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_JobMesDeliverJob", x => x.Id); }); migrationBuilder.CreateTable( name: "JobMesDeliverJobDetail", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ContainerCode = table.Column(type: "nvarchar(max)", nullable: true), ContainerDesc = table.Column(type: "nvarchar(max)", nullable: true), ContainerName = table.Column(type: "nvarchar(max)", nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), FromLocationCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), InventoryCount = table.Column(type: "decimal(18,2)", nullable: false), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), MasterID = table.Column(type: "uniqueidentifier", nullable: false), Number = table.Column(type: "nvarchar(max)", nullable: true), Remark = table.Column(type: "nvarchar(max)", maxLength: 4096, nullable: true), Status = table.Column(type: "int", nullable: false), TenantId = table.Column(type: "uniqueidentifier", nullable: true), ToLocationCode = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) }, constraints: table => { table.PrimaryKey("PK_JobMesDeliverJobDetail", x => x.Id); table.ForeignKey( name: "FK_JobMesDeliverJobDetail_JobMesDeliverJob_MasterID", column: x => x.MasterID, principalTable: "JobMesDeliverJob", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_JobMesDeliverJob_Company_Number", table: "JobMesDeliverJob", columns: new[] { "Company", "Number" }, unique: true); migrationBuilder.CreateIndex( name: "IX_JobMesDeliverJobDetail_MasterID", table: "JobMesDeliverJobDetail", column: "MasterID"); } } }