Initial commit
This commit is contained in:
+254
@@ -0,0 +1,254 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PowderCoating.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddOvenScheduling : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "CureTemperatureF",
|
||||
table: "InventoryItems",
|
||||
type: "decimal(18,2)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "CureTimeMinutes",
|
||||
table: "InventoryItems",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "MaxCureTemperatureF",
|
||||
table: "Equipment",
|
||||
type: "decimal(18,2)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "MaxLoadSqFt",
|
||||
table: "Equipment",
|
||||
type: "decimal(18,2)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "MaxLoadWeightLbs",
|
||||
table: "Equipment",
|
||||
type: "decimal(18,2)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "MinCureTemperatureF",
|
||||
table: "Equipment",
|
||||
type: "decimal(18,2)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OvenCycleMinutes",
|
||||
table: "Equipment",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OvenBatches",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
BatchNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
EquipmentId = table.Column<int>(type: "int", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
ScheduledDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ScheduledStartTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
EstimatedEndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
ActualStartTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
ActualEndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
TotalSurfaceAreaSqFt = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||
CureTemperatureF = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
||||
CycleMinutes = table.Column<int>(type: "int", nullable: false),
|
||||
PrimaryColorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
PrimaryColorCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AiSuggested = table.Column<bool>(type: "bit", nullable: false),
|
||||
AiReasoningJson = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
CompanyId = table.Column<int>(type: "int", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||
DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
DeletedBy = table.Column<string>(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<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
OvenBatchId = table.Column<int>(type: "int", nullable: false),
|
||||
JobId = table.Column<int>(type: "int", nullable: false),
|
||||
JobItemId = table.Column<int>(type: "int", nullable: false),
|
||||
JobItemCoatId = table.Column<int>(type: "int", nullable: false),
|
||||
SurfaceAreaContribution = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||
CoatPassNumber = table.Column<int>(type: "int", nullable: false),
|
||||
SortOrder = table.Column<int>(type: "int", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
CompanyId = table.Column<int>(type: "int", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||
DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
DeletedBy = table.Column<string>(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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user