using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PowderCoating.Infrastructure.Migrations { /// public partial class AddOvenCostTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "OvenCostId", table: "Quotes", type: "int", nullable: true); migrationBuilder.CreateTable( name: "OvenCosts", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), CostPerHour = table.Column(type: "decimal(18,2)", 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_OvenCosts", x => x.Id); table.ForeignKey( name: "FK_OvenCosts_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, 2, 20, 17, 17, 1, 498, DateTimeKind.Utc).AddTicks(6759)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 2, 20, 17, 17, 1, 498, DateTimeKind.Utc).AddTicks(6764)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 2, 20, 17, 17, 1, 498, DateTimeKind.Utc).AddTicks(6765)); migrationBuilder.CreateIndex( name: "IX_Quotes_OvenCostId", table: "Quotes", column: "OvenCostId"); migrationBuilder.CreateIndex( name: "IX_OvenCosts_CompanyId", table: "OvenCosts", column: "CompanyId"); migrationBuilder.AddForeignKey( name: "FK_Quotes_OvenCosts_OvenCostId", table: "Quotes", column: "OvenCostId", principalTable: "OvenCosts", principalColumn: "Id", onDelete: ReferentialAction.Restrict); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Quotes_OvenCosts_OvenCostId", table: "Quotes"); migrationBuilder.DropTable( name: "OvenCosts"); migrationBuilder.DropIndex( name: "IX_Quotes_OvenCostId", table: "Quotes"); migrationBuilder.DropColumn( name: "OvenCostId", table: "Quotes"); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 2, 19, 14, 11, 2, 780, DateTimeKind.Utc).AddTicks(3625)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 2, 19, 14, 11, 2, 780, DateTimeKind.Utc).AddTicks(3630)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 2, 19, 14, 11, 2, 780, DateTimeKind.Utc).AddTicks(3632)); } } }