using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CutList.Web.Migrations { /// public partial class AddJobStock : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "JobStocks", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), JobId = table.Column(type: "int", nullable: false), MaterialId = table.Column(type: "int", nullable: false), StockItemId = table.Column(type: "int", nullable: true), LengthInches = table.Column(type: "decimal(10,4)", precision: 10, scale: 4, nullable: false), Quantity = table.Column(type: "int", nullable: false), IsCustomLength = table.Column(type: "bit", nullable: false), Priority = table.Column(type: "int", nullable: false), SortOrder = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_JobStocks", x => x.Id); table.ForeignKey( name: "FK_JobStocks_Jobs_JobId", column: x => x.JobId, principalTable: "Jobs", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_JobStocks_Materials_MaterialId", column: x => x.MaterialId, principalTable: "Materials", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_JobStocks_StockItems_StockItemId", column: x => x.StockItemId, principalTable: "StockItems", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateIndex( name: "IX_JobStocks_JobId", table: "JobStocks", column: "JobId"); migrationBuilder.CreateIndex( name: "IX_JobStocks_MaterialId", table: "JobStocks", column: "MaterialId"); migrationBuilder.CreateIndex( name: "IX_JobStocks_StockItemId", table: "JobStocks", column: "StockItemId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "JobStocks"); } } }