feat: Add material dimensions with typed properties
Implement TPH inheritance for material dimensions: - MaterialShape enum with display names and parsing - MaterialType enum (Steel, Aluminum, Stainless, etc.) - MaterialDimensions base class with derived types per shape - Auto-generate size strings from typed dimensions - SortOrder field for numeric dimension sorting Each shape has specific dimension properties: - RoundBar: Diameter - RoundTube: OuterDiameter, Wall - FlatBar: Width, Thickness - SquareBar/Tube: Size, Wall - RectangularTube: Width, Height, Wall - Angle: Leg1, Leg2, Thickness - Channel: Height, Flange, Web - IBeam: Height, WeightPerFoot - Pipe: NominalSize, Wall, Schedule Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CutList.Web.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixMaterialShapeEnumValues : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// Convert display names to enum names
|
||||
migrationBuilder.Sql(@"
|
||||
UPDATE Materials SET Shape = 'RoundBar' WHERE Shape = 'Round Bar';
|
||||
UPDATE Materials SET Shape = 'RoundTube' WHERE Shape = 'Round Tube';
|
||||
UPDATE Materials SET Shape = 'FlatBar' WHERE Shape = 'Flat Bar';
|
||||
UPDATE Materials SET Shape = 'SquareBar' WHERE Shape = 'Square Bar';
|
||||
UPDATE Materials SET Shape = 'SquareTube' WHERE Shape = 'Square Tube';
|
||||
UPDATE Materials SET Shape = 'RectangularTube' WHERE Shape = 'Rectangular Tube';
|
||||
UPDATE Materials SET Shape = 'IBeam' WHERE Shape = 'I-Beam';
|
||||
");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user