using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PowderCoating.Infrastructure.Migrations { /// public partial class AddOvenScheduling : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "CureTemperatureF", table: "InventoryItems", type: "decimal(18,2)", nullable: true); migrationBuilder.AddColumn( name: "CureTimeMinutes", table: "InventoryItems", type: "int", nullable: true); migrationBuilder.AddColumn( name: "MaxCureTemperatureF", table: "Equipment", type: "decimal(18,2)", nullable: true); migrationBuilder.AddColumn( name: "MaxLoadSqFt", table: "Equipment", type: "decimal(18,2)", nullable: true); migrationBuilder.AddColumn( name: "MaxLoadWeightLbs", table: "Equipment", type: "decimal(18,2)", nullable: true); migrationBuilder.AddColumn( name: "MinCureTemperatureF", table: "Equipment", type: "decimal(18,2)", nullable: true); migrationBuilder.AddColumn( name: "OvenCycleMinutes", table: "Equipment", type: "int", nullable: true); migrationBuilder.CreateTable( name: "OvenBatches", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), BatchNumber = table.Column(type: "nvarchar(max)", nullable: false), EquipmentId = table.Column(type: "int", nullable: false), Status = table.Column(type: "int", nullable: false), ScheduledDate = table.Column(type: "datetime2", nullable: false), ScheduledStartTime = table.Column(type: "datetime2", nullable: true), EstimatedEndTime = table.Column(type: "datetime2", nullable: true), ActualStartTime = table.Column(type: "datetime2", nullable: true), ActualEndTime = table.Column(type: "datetime2", nullable: true), TotalSurfaceAreaSqFt = table.Column(type: "decimal(18,2)", nullable: false), CureTemperatureF = table.Column(type: "decimal(18,2)", nullable: true), CycleMinutes = table.Column(type: "int", nullable: false), PrimaryColorName = table.Column(type: "nvarchar(max)", nullable: true), PrimaryColorCode = table.Column(type: "nvarchar(max)", nullable: true), AiSuggested = table.Column(type: "bit", nullable: false), AiReasoningJson = table.Column(type: "nvarchar(max)", nullable: true), Notes = table.Column(type: "nvarchar(max)", nullable: true), CompanyId = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), UpdatedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false), DeletedAt = table.Column(type: "datetime2", nullable: true), DeletedBy = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_OvenBatches", x => x.Id); table.ForeignKey( name: "FK_OvenBatches_Equipment_EquipmentId", column: x => x.EquipmentId, principalTable: "Equipment", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "OvenBatchItems", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), OvenBatchId = table.Column(type: "int", nullable: false), JobId = table.Column(type: "int", nullable: false), JobItemId = table.Column(type: "int", nullable: false), JobItemCoatId = table.Column(type: "int", nullable: false), SurfaceAreaContribution = table.Column(type: "decimal(18,2)", nullable: false), CoatPassNumber = table.Column(type: "int", nullable: false), SortOrder = table.Column(type: "int", nullable: false), Status = table.Column(type: "int", nullable: false), Notes = table.Column(type: "nvarchar(max)", nullable: true), CompanyId = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), UpdatedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false), DeletedAt = table.Column(type: "datetime2", nullable: true), DeletedBy = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_OvenBatchItems", x => x.Id); table.ForeignKey( name: "FK_OvenBatchItems_JobItemCoats_JobItemCoatId", column: x => x.JobItemCoatId, principalTable: "JobItemCoats", principalColumn: "Id"); table.ForeignKey( name: "FK_OvenBatchItems_JobItems_JobItemId", column: x => x.JobItemId, principalTable: "JobItems", principalColumn: "Id"); table.ForeignKey( name: "FK_OvenBatchItems_Jobs_JobId", column: x => x.JobId, principalTable: "Jobs", principalColumn: "Id"); table.ForeignKey( name: "FK_OvenBatchItems_OvenBatches_OvenBatchId", column: x => x.OvenBatchId, principalTable: "OvenBatches", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 3, 11, 14, 56, 42, 32, DateTimeKind.Utc).AddTicks(2380)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 3, 11, 14, 56, 42, 32, DateTimeKind.Utc).AddTicks(2386)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 3, 11, 14, 56, 42, 32, DateTimeKind.Utc).AddTicks(2387)); migrationBuilder.CreateIndex( name: "IX_OvenBatches_EquipmentId", table: "OvenBatches", column: "EquipmentId"); migrationBuilder.CreateIndex( name: "IX_OvenBatchItems_JobId", table: "OvenBatchItems", column: "JobId"); migrationBuilder.CreateIndex( name: "IX_OvenBatchItems_JobItemCoatId", table: "OvenBatchItems", column: "JobItemCoatId"); migrationBuilder.CreateIndex( name: "IX_OvenBatchItems_JobItemId", table: "OvenBatchItems", column: "JobItemId"); migrationBuilder.CreateIndex( name: "IX_OvenBatchItems_OvenBatchId", table: "OvenBatchItems", column: "OvenBatchId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "OvenBatchItems"); migrationBuilder.DropTable( name: "OvenBatches"); migrationBuilder.DropColumn( name: "CureTemperatureF", table: "InventoryItems"); migrationBuilder.DropColumn( name: "CureTimeMinutes", table: "InventoryItems"); migrationBuilder.DropColumn( name: "MaxCureTemperatureF", table: "Equipment"); migrationBuilder.DropColumn( name: "MaxLoadSqFt", table: "Equipment"); migrationBuilder.DropColumn( name: "MaxLoadWeightLbs", table: "Equipment"); migrationBuilder.DropColumn( name: "MinCureTemperatureF", table: "Equipment"); migrationBuilder.DropColumn( name: "OvenCycleMinutes", table: "Equipment"); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 3, 11, 13, 22, 0, 781, DateTimeKind.Utc).AddTicks(2667)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 3, 11, 13, 22, 0, 781, DateTimeKind.Utc).AddTicks(2674)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 3, 11, 13, 22, 0, 781, DateTimeKind.Utc).AddTicks(2675)); } } }