using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PowderCoating.Infrastructure.Migrations { /// public partial class AddSamplePanel : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "HasSamplePanel", table: "InventoryItems", type: "bit", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsCoating", table: "InventoryItems", type: "bit", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "SamplePanelNotes", table: "InventoryItems", type: "nvarchar(max)", nullable: true); // Backfill IsCoating from the category lookup for all existing items migrationBuilder.Sql(@" UPDATE ii SET ii.IsCoating = 1 FROM InventoryItems ii INNER JOIN InventoryCategoryLookups icl ON icl.Id = ii.InventoryCategoryId WHERE icl.IsCoating = 1 AND icl.IsDeleted = 0 "); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 4, 17, 16, 6, 41, 332, DateTimeKind.Utc).AddTicks(6769)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 4, 17, 16, 6, 41, 332, DateTimeKind.Utc).AddTicks(6775)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 4, 17, 16, 6, 41, 332, DateTimeKind.Utc).AddTicks(6776)); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "HasSamplePanel", table: "InventoryItems"); migrationBuilder.DropColumn( name: "IsCoating", table: "InventoryItems"); migrationBuilder.DropColumn( name: "SamplePanelNotes", table: "InventoryItems"); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 4, 17, 4, 42, 51, 151, DateTimeKind.Utc).AddTicks(259)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 4, 17, 4, 42, 51, 151, DateTimeKind.Utc).AddTicks(266)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 4, 17, 4, 42, 51, 151, DateTimeKind.Utc).AddTicks(268)); } } }