131 lines
5.1 KiB
C#
131 lines
5.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PowderCoating.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddOvenCostTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "OvenCostId",
|
|
table: "Quotes",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "OvenCosts",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Label = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
|
CostPerHour = table.Column<decimal>(type: "decimal(18,2)", 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_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);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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));
|
|
}
|
|
}
|
|
}
|