using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Data.SeaHavenIndustries.Migrations { /// public partial class AddVendorRoadmapOperations : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "AvailabilityStatus", table: "Vendors", type: "nvarchar(max)", nullable: false, defaultValue: "Unknown"); migrationBuilder.AddColumn( name: "AvailabilityUpdatedAt", table: "Vendors", type: "datetime2", nullable: true); migrationBuilder.AddColumn( name: "CommercialStatusUpdatedAt", table: "Dispatches", type: "datetime2", nullable: true); migrationBuilder.AddColumn( name: "EstimatedArrivalAt", table: "Dispatches", type: "datetime2", nullable: true); migrationBuilder.AddColumn( name: "EtaManualOverride", table: "Dispatches", type: "bit", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "InvoiceNumber", table: "Dispatches", type: "nvarchar(max)", nullable: true); migrationBuilder.AddColumn( name: "InvoiceStatus", table: "Dispatches", type: "nvarchar(max)", nullable: false, defaultValue: "Not Submitted"); migrationBuilder.AddColumn( name: "PaymentStatus", table: "Dispatches", type: "nvarchar(max)", nullable: false, defaultValue: "Unavailable"); migrationBuilder.CreateTable( name: "SitePreferredVendors", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), LocationId = table.Column(type: "int", nullable: false), VendorId = table.Column(type: "int", nullable: false), Trade = table.Column(type: "nvarchar(450)", nullable: true), SortOrder = table.Column(type: "int", nullable: false), UpdatedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: true), createdby = table.Column(type: "nvarchar(max)", nullable: true), DeleterUserId = table.Column(type: "nvarchar(max)", nullable: true), DeletionTime = table.Column(type: "datetime2", nullable: true), CreatedDate = table.Column(type: "datetime2", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierUserId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_SitePreferredVendors", x => x.Id); table.ForeignKey( name: "FK_SitePreferredVendors_Locations_LocationId", column: x => x.LocationId, principalTable: "Locations", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SitePreferredVendors_Vendors_VendorId", column: x => x.VendorId, principalTable: "Vendors", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "VendorCompletionDocuments", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), VendorId = table.Column(type: "int", nullable: false), DispatchId = table.Column(type: "int", nullable: false), WorkOrderId = table.Column(type: "int", nullable: false), OriginalFileName = table.Column(type: "nvarchar(max)", nullable: false), StoredFileName = table.Column(type: "nvarchar(max)", nullable: false), ContentType = table.Column(type: "nvarchar(max)", nullable: false), SizeBytes = table.Column(type: "bigint", nullable: false), ScanStatus = table.Column(type: "nvarchar(max)", nullable: false), ReviewStatus = table.Column(type: "nvarchar(max)", nullable: false), RejectionReason = table.Column(type: "nvarchar(max)", nullable: true), Version = table.Column(type: "int", nullable: false), ReplacesDocumentId = table.Column(type: "int", nullable: true), ScannedAt = table.Column(type: "datetime2", nullable: true), ReviewedAt = table.Column(type: "datetime2", nullable: true), IsDeleted = table.Column(type: "bit", nullable: true), createdby = table.Column(type: "nvarchar(max)", nullable: true), DeleterUserId = table.Column(type: "nvarchar(max)", nullable: true), DeletionTime = table.Column(type: "datetime2", nullable: true), CreatedDate = table.Column(type: "datetime2", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierUserId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VendorCompletionDocuments", x => x.Id); table.ForeignKey( name: "FK_VendorCompletionDocuments_Dispatches_DispatchId", column: x => x.DispatchId, principalTable: "Dispatches", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_VendorCompletionDocuments_Vendors_VendorId", column: x => x.VendorId, principalTable: "Vendors", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_VendorCompletionDocuments_workOrders_WorkOrderId", column: x => x.WorkOrderId, principalTable: "workOrders", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_SitePreferredVendors_LocationId_VendorId", table: "SitePreferredVendors", columns: new[] { "LocationId", "VendorId" }, unique: true, filter: "[Trade] IS NULL"); migrationBuilder.CreateIndex( name: "IX_SitePreferredVendors_LocationId_VendorId_Trade", table: "SitePreferredVendors", columns: new[] { "LocationId", "VendorId", "Trade" }, unique: true, filter: "[Trade] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_SitePreferredVendors_VendorId", table: "SitePreferredVendors", column: "VendorId"); migrationBuilder.CreateIndex( name: "IX_VendorCompletionDocuments_DispatchId", table: "VendorCompletionDocuments", column: "DispatchId"); migrationBuilder.CreateIndex( name: "IX_VendorCompletionDocuments_VendorId", table: "VendorCompletionDocuments", column: "VendorId"); migrationBuilder.CreateIndex( name: "IX_VendorCompletionDocuments_WorkOrderId", table: "VendorCompletionDocuments", column: "WorkOrderId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "SitePreferredVendors"); migrationBuilder.DropTable( name: "VendorCompletionDocuments"); migrationBuilder.DropColumn( name: "AvailabilityStatus", table: "Vendors"); migrationBuilder.DropColumn( name: "AvailabilityUpdatedAt", table: "Vendors"); migrationBuilder.DropColumn( name: "CommercialStatusUpdatedAt", table: "Dispatches"); migrationBuilder.DropColumn( name: "EstimatedArrivalAt", table: "Dispatches"); migrationBuilder.DropColumn( name: "EtaManualOverride", table: "Dispatches"); migrationBuilder.DropColumn( name: "InvoiceNumber", table: "Dispatches"); migrationBuilder.DropColumn( name: "InvoiceStatus", table: "Dispatches"); migrationBuilder.DropColumn( name: "PaymentStatus", table: "Dispatches"); } } }