using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CutList.Web.Migrations { /// public partial class AddMaterialStockLengths : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "MaterialStockLengths", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), MaterialId = table.Column(type: "int", nullable: false), LengthInches = table.Column(type: "decimal(10,4)", precision: 10, scale: 4, nullable: false), Notes = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), IsActive = table.Column(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); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "MaterialStockLengths"); } } }