Files
PowderCoatingLogix/src/PowderCoating.Infrastructure/Migrations/20260318124847_AddJobTimeEntries.cs
T
2026-04-23 21:38:24 -04:00

113 lines
4.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PowderCoating.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddJobTimeEntries : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "JobTimeEntries",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
JobId = table.Column<int>(type: "int", nullable: false),
ShopWorkerId = table.Column<int>(type: "int", nullable: false),
WorkDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HoursWorked = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
Stage = table.Column<string>(type: "nvarchar(max)", nullable: true),
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
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_JobTimeEntries", x => x.Id);
table.ForeignKey(
name: "FK_JobTimeEntries_Jobs_JobId",
column: x => x.JobId,
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_JobTimeEntries_ShopWorkers_ShopWorkerId",
column: x => x.ShopWorkerId,
principalTable: "ShopWorkers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 3, 18, 12, 48, 44, 746, DateTimeKind.Utc).AddTicks(2691));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 3, 18, 12, 48, 44, 746, DateTimeKind.Utc).AddTicks(2697));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 3, 18, 12, 48, 44, 746, DateTimeKind.Utc).AddTicks(2699));
migrationBuilder.CreateIndex(
name: "IX_JobTimeEntries_JobId",
table: "JobTimeEntries",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_JobTimeEntries_ShopWorkerId",
table: "JobTimeEntries",
column: "ShopWorkerId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "JobTimeEntries");
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 3, 17, 20, 59, 24, 246, DateTimeKind.Utc).AddTicks(3737));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 3, 17, 20, 59, 24, 246, DateTimeKind.Utc).AddTicks(3746));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 3, 17, 20, 59, 24, 246, DateTimeKind.Utc).AddTicks(3748));
}
}
}