using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PowderCoating.Infrastructure.Migrations { /// public partial class AddCompanyBlastSetupsTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "BlastSetupId", table: "QuoteItemPrepServices", type: "int", nullable: true); migrationBuilder.AddColumn( name: "RequiresBlastSetup", table: "PrepServices", type: "bit", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "BlastSetupId", table: "JobItemPrepServices", type: "int", nullable: true); migrationBuilder.CreateTable( name: "CompanyBlastSetups", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), SetupType = table.Column(type: "int", nullable: false), CompressorCfm = table.Column(type: "decimal(18,2)", nullable: false), BlastNozzleSize = table.Column(type: "int", nullable: false), PrimarySubstrate = table.Column(type: "int", nullable: false), BlastRateSqFtPerHourOverride = table.Column(type: "decimal(18,2)", nullable: true), IsDefault = table.Column(type: "bit", nullable: false), IsActive = table.Column(type: "bit", nullable: false), DisplayOrder = table.Column(type: "int", nullable: false), CompanyId = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), UpdatedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false), DeletedAt = table.Column(type: "datetime2", nullable: true), DeletedBy = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_CompanyBlastSetups", x => x.Id); table.ForeignKey( name: "FK_CompanyBlastSetups_Companies_CompanyId", column: x => x.CompanyId, principalTable: "Companies", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 4, 21, 1, 24, 5, 983, DateTimeKind.Utc).AddTicks(5208)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 4, 21, 1, 24, 5, 983, DateTimeKind.Utc).AddTicks(5215)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 4, 21, 1, 24, 5, 983, DateTimeKind.Utc).AddTicks(5220)); migrationBuilder.CreateIndex( name: "IX_QuoteItemPrepServices_BlastSetupId", table: "QuoteItemPrepServices", column: "BlastSetupId"); migrationBuilder.CreateIndex( name: "IX_JobItemPrepServices_BlastSetupId", table: "JobItemPrepServices", column: "BlastSetupId"); migrationBuilder.CreateIndex( name: "IX_CompanyBlastSetups_CompanyId", table: "CompanyBlastSetups", column: "CompanyId"); migrationBuilder.AddForeignKey( name: "FK_JobItemPrepServices_CompanyBlastSetups_BlastSetupId", table: "JobItemPrepServices", column: "BlastSetupId", principalTable: "CompanyBlastSetups", principalColumn: "Id", onDelete: ReferentialAction.SetNull); migrationBuilder.AddForeignKey( name: "FK_QuoteItemPrepServices_CompanyBlastSetups_BlastSetupId", table: "QuoteItemPrepServices", column: "BlastSetupId", principalTable: "CompanyBlastSetups", principalColumn: "Id", onDelete: ReferentialAction.SetNull); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_JobItemPrepServices_CompanyBlastSetups_BlastSetupId", table: "JobItemPrepServices"); migrationBuilder.DropForeignKey( name: "FK_QuoteItemPrepServices_CompanyBlastSetups_BlastSetupId", table: "QuoteItemPrepServices"); migrationBuilder.DropTable( name: "CompanyBlastSetups"); migrationBuilder.DropIndex( name: "IX_QuoteItemPrepServices_BlastSetupId", table: "QuoteItemPrepServices"); migrationBuilder.DropIndex( name: "IX_JobItemPrepServices_BlastSetupId", table: "JobItemPrepServices"); migrationBuilder.DropColumn( name: "BlastSetupId", table: "QuoteItemPrepServices"); migrationBuilder.DropColumn( name: "RequiresBlastSetup", table: "PrepServices"); migrationBuilder.DropColumn( name: "BlastSetupId", table: "JobItemPrepServices"); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 4, 21, 0, 33, 43, 88, DateTimeKind.Utc).AddTicks(6131)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 4, 21, 0, 33, 43, 88, DateTimeKind.Utc).AddTicks(6138)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 4, 21, 0, 33, 43, 88, DateTimeKind.Utc).AddTicks(6139)); } } }