using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PowderCoating.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class AddInvoiceItemRevenueAccount : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "RevenueAccountId",
                table: "InvoiceItems",
                type: "int",
                nullable: true);

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 39, 41, 974, DateTimeKind.Utc).AddTicks(5262));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 39, 41, 974, DateTimeKind.Utc).AddTicks(5268));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 39, 41, 974, DateTimeKind.Utc).AddTicks(5293));

            migrationBuilder.CreateIndex(
                name: "IX_InvoiceItems_RevenueAccountId",
                table: "InvoiceItems",
                column: "RevenueAccountId");

            migrationBuilder.AddForeignKey(
                name: "FK_InvoiceItems_Accounts_RevenueAccountId",
                table: "InvoiceItems",
                column: "RevenueAccountId",
                principalTable: "Accounts",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_InvoiceItems_RevenueAccountId",
                table: "InvoiceItems");

            migrationBuilder.DropColumn(
                name: "RevenueAccountId",
                table: "InvoiceItems");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 32, 8, 116, DateTimeKind.Utc).AddTicks(4268));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 32, 8, 116, DateTimeKind.Utc).AddTicks(4274));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 32, 8, 116, DateTimeKind.Utc).AddTicks(4275));
        }
    }
}
