178 lines
7.3 KiB
C#
178 lines
7.3 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PowderCoating.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddCompanyBlastSetupsTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "BlastSetupId",
|
|
table: "QuoteItemPrepServices",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "RequiresBlastSetup",
|
|
table: "PrepServices",
|
|
type: "bit",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "BlastSetupId",
|
|
table: "JobItemPrepServices",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "CompanyBlastSetups",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
|
SetupType = table.Column<int>(type: "int", nullable: false),
|
|
CompressorCfm = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
BlastNozzleSize = table.Column<int>(type: "int", nullable: false),
|
|
PrimarySubstrate = table.Column<int>(type: "int", nullable: false),
|
|
BlastRateSqFtPerHourOverride = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
IsDefault = table.Column<bool>(type: "bit", nullable: false),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
|
DisplayOrder = 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_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);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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));
|
|
}
|
|
}
|
|
}
|