using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PowderCoating.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class MigrateTimeEntriesToUserId : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_JobTimeEntries_ShopWorkers_ShopWorkerId",
                table: "JobTimeEntries");

            migrationBuilder.AlterColumn<int>(
                name: "ShopWorkerId",
                table: "JobTimeEntries",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AddColumn<string>(
                name: "UserDisplayName",
                table: "JobTimeEntries",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "UserId",
                table: "JobTimeEntries",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 5, 5, 23, 10, 14, 763, DateTimeKind.Utc).AddTicks(8603));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 5, 5, 23, 10, 14, 763, DateTimeKind.Utc).AddTicks(8610));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 5, 5, 23, 10, 14, 763, DateTimeKind.Utc).AddTicks(8612));

            migrationBuilder.AddForeignKey(
                name: "FK_JobTimeEntries_ShopWorkers_ShopWorkerId",
                table: "JobTimeEntries",
                column: "ShopWorkerId",
                principalTable: "ShopWorkers",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_JobTimeEntries_ShopWorkers_ShopWorkerId",
                table: "JobTimeEntries");

            migrationBuilder.DropColumn(
                name: "UserDisplayName",
                table: "JobTimeEntries");

            migrationBuilder.DropColumn(
                name: "UserId",
                table: "JobTimeEntries");

            migrationBuilder.AlterColumn<int>(
                name: "ShopWorkerId",
                table: "JobTimeEntries",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 5, 5, 19, 13, 29, 537, DateTimeKind.Utc).AddTicks(4011));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 5, 5, 19, 13, 29, 537, DateTimeKind.Utc).AddTicks(4019));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 5, 5, 19, 13, 29, 537, DateTimeKind.Utc).AddTicks(4021));

            migrationBuilder.AddForeignKey(
                name: "FK_JobTimeEntries_ShopWorkers_ShopWorkerId",
                table: "JobTimeEntries",
                column: "ShopWorkerId",
                principalTable: "ShopWorkers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
