Files
PowderCoatingLogix/src/PowderCoating.Infrastructure/Migrations_archive/20260225135132_AddQuoteItemPrepServices.cs
T
2026-04-23 21:38:24 -04:00

132 lines
5.5 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PowderCoating.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddQuoteItemPrepServices : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsLaborItem",
table: "QuoteItems",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "QuoteItemPrepServices",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
QuoteItemId = table.Column<int>(type: "int", nullable: false),
PrepServiceId = table.Column<int>(type: "int", nullable: false),
EstimatedMinutes = table.Column<int>(type: "int", nullable: false),
CompanyId = table.Column<int>(type: "int", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
DeletedBy = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_QuoteItemPrepServices", x => x.Id);
table.ForeignKey(
name: "FK_QuoteItemPrepServices_Companies_CompanyId",
column: x => x.CompanyId,
principalTable: "Companies",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_QuoteItemPrepServices_PrepServices_PrepServiceId",
column: x => x.PrepServiceId,
principalTable: "PrepServices",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_QuoteItemPrepServices_QuoteItems_QuoteItemId",
column: x => x.QuoteItemId,
principalTable: "QuoteItems",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 2, 25, 13, 51, 28, 792, DateTimeKind.Utc).AddTicks(5967));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 2, 25, 13, 51, 28, 792, DateTimeKind.Utc).AddTicks(5974));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 2, 25, 13, 51, 28, 792, DateTimeKind.Utc).AddTicks(5975));
migrationBuilder.CreateIndex(
name: "IX_QuoteItemPrepServices_CompanyId",
table: "QuoteItemPrepServices",
column: "CompanyId");
migrationBuilder.CreateIndex(
name: "IX_QuoteItemPrepServices_PrepServiceId",
table: "QuoteItemPrepServices",
column: "PrepServiceId");
migrationBuilder.CreateIndex(
name: "IX_QuoteItemPrepServices_QuoteItemId",
table: "QuoteItemPrepServices",
column: "QuoteItemId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "QuoteItemPrepServices");
migrationBuilder.DropColumn(
name: "IsLaborItem",
table: "QuoteItems");
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 2, 25, 3, 39, 48, 790, DateTimeKind.Utc).AddTicks(1225));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 2, 25, 3, 39, 48, 790, DateTimeKind.Utc).AddTicks(1233));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 2, 25, 3, 39, 48, 790, DateTimeKind.Utc).AddTicks(1234));
}
}
}