using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PowderCoating.Infrastructure.Migrations { /// public partial class AddAiItemPrediction : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "AiPredictionId", table: "QuoteItems", type: "int", nullable: true); migrationBuilder.AddColumn( name: "AiPredictionId", table: "JobItems", type: "int", nullable: true); migrationBuilder.CreateTable( name: "AiItemPredictions", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), PredictedSurfaceAreaSqFt = table.Column(type: "decimal(18,2)", nullable: false), PredictedMinutes = table.Column(type: "int", nullable: false), PredictedComplexity = table.Column(type: "nvarchar(max)", nullable: false), PredictedUnitPrice = table.Column(type: "decimal(18,2)", nullable: false), Confidence = table.Column(type: "nvarchar(max)", nullable: false), Reasoning = table.Column(type: "nvarchar(max)", nullable: true), AiTags = table.Column(type: "nvarchar(max)", nullable: true), ConversationRounds = table.Column(type: "int", nullable: false), UserOverrodeEstimate = table.Column(type: "bit", 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_AiItemPredictions", x => x.Id); }); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 3, 11, 12, 50, 33, 934, DateTimeKind.Utc).AddTicks(4668)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 3, 11, 12, 50, 33, 934, DateTimeKind.Utc).AddTicks(4675)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 3, 11, 12, 50, 33, 934, DateTimeKind.Utc).AddTicks(4677)); migrationBuilder.CreateIndex( name: "IX_QuoteItems_AiPredictionId", table: "QuoteItems", column: "AiPredictionId"); migrationBuilder.CreateIndex( name: "IX_JobItems_AiPredictionId", table: "JobItems", column: "AiPredictionId"); migrationBuilder.AddForeignKey( name: "FK_JobItems_AiItemPredictions_AiPredictionId", table: "JobItems", column: "AiPredictionId", principalTable: "AiItemPredictions", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_QuoteItems_AiItemPredictions_AiPredictionId", table: "QuoteItems", column: "AiPredictionId", principalTable: "AiItemPredictions", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_JobItems_AiItemPredictions_AiPredictionId", table: "JobItems"); migrationBuilder.DropForeignKey( name: "FK_QuoteItems_AiItemPredictions_AiPredictionId", table: "QuoteItems"); migrationBuilder.DropTable( name: "AiItemPredictions"); migrationBuilder.DropIndex( name: "IX_QuoteItems_AiPredictionId", table: "QuoteItems"); migrationBuilder.DropIndex( name: "IX_JobItems_AiPredictionId", table: "JobItems"); migrationBuilder.DropColumn( name: "AiPredictionId", table: "QuoteItems"); migrationBuilder.DropColumn( name: "AiPredictionId", table: "JobItems"); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 3, 11, 3, 27, 34, 112, DateTimeKind.Utc).AddTicks(697)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 3, 11, 3, 27, 34, 112, DateTimeKind.Utc).AddTicks(704)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 3, 11, 3, 27, 34, 112, DateTimeKind.Utc).AddTicks(706)); } } }