using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ZB.MOM.WW.OtOpcUa.Configuration.Migrations { /// public partial class AddEquipmentImportBatch : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "EquipmentImportBatch", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ClusterId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), CreatedBy = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), CreatedAtUtc = table.Column(type: "datetime2(3)", nullable: false), RowsStaged = table.Column(type: "int", nullable: false), RowsAccepted = table.Column(type: "int", nullable: false), RowsRejected = table.Column(type: "int", nullable: false), FinalisedAtUtc = table.Column(type: "datetime2(3)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EquipmentImportBatch", x => x.Id); }); migrationBuilder.CreateTable( name: "EquipmentImportRow", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), BatchId = table.Column(type: "uniqueidentifier", nullable: false), LineNumberInFile = table.Column(type: "int", nullable: false), IsAccepted = table.Column(type: "bit", nullable: false), RejectReason = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), ZTag = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), MachineCode = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), SAPID = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), EquipmentId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), EquipmentUuid = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), UnsAreaName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), UnsLineName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Manufacturer = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), Model = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), SerialNumber = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), HardwareRevision = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), SoftwareRevision = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), YearOfConstruction = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: true), AssetLocation = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), ManufacturerUri = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), DeviceManualUri = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true) }, constraints: table => { table.PrimaryKey("PK_EquipmentImportRow", x => x.Id); table.ForeignKey( name: "FK_EquipmentImportRow_EquipmentImportBatch_BatchId", column: x => x.BatchId, principalTable: "EquipmentImportBatch", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_EquipmentImportBatch_Creator_Finalised", table: "EquipmentImportBatch", columns: new[] { "CreatedBy", "FinalisedAtUtc" }); migrationBuilder.CreateIndex( name: "IX_EquipmentImportRow_Batch", table: "EquipmentImportRow", column: "BatchId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "EquipmentImportRow"); migrationBuilder.DropTable( name: "EquipmentImportBatch"); } } }