Introduces a new entity to track available stock lengths per material, enabling in-stock vs. purchase-needed distinction during optimization. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CutList.Web.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddMaterialStockLengths : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "MaterialStockLengths",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
MaterialId = table.Column<int>(type: "int", nullable: false),
|
|
LengthInches = table.Column<decimal>(type: "decimal(10,4)", precision: 10, scale: 4, nullable: false),
|
|
Notes = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_MaterialStockLengths", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_MaterialStockLengths_Materials_MaterialId",
|
|
column: x => x.MaterialId,
|
|
principalTable: "Materials",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MaterialStockLengths_MaterialId_LengthInches",
|
|
table: "MaterialStockLengths",
|
|
columns: new[] { "MaterialId", "LengthInches" },
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "MaterialStockLengths");
|
|
}
|
|
}
|
|
}
|