using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PowderCoating.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class FixGiftCertificateUniqueIndexPerCompany : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_GiftCertificates_CertificateCode",
                table: "GiftCertificates");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 4, 1, 14, 16, 49, 288, DateTimeKind.Utc).AddTicks(7180));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 4, 1, 14, 16, 49, 288, DateTimeKind.Utc).AddTicks(7185));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 4, 1, 14, 16, 49, 288, DateTimeKind.Utc).AddTicks(7186));

            migrationBuilder.CreateIndex(
                name: "IX_GiftCertificates_CompanyId_CertificateCode",
                table: "GiftCertificates",
                columns: new[] { "CompanyId", "CertificateCode" },
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_GiftCertificates_CompanyId_CertificateCode",
                table: "GiftCertificates");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 4, 1, 13, 17, 21, 812, DateTimeKind.Utc).AddTicks(1883));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 4, 1, 13, 17, 21, 812, DateTimeKind.Utc).AddTicks(1891));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 4, 1, 13, 17, 21, 812, DateTimeKind.Utc).AddTicks(1893));

            migrationBuilder.CreateIndex(
                name: "IX_GiftCertificates_CertificateCode",
                table: "GiftCertificates",
                column: "CertificateCode",
                unique: true);
        }
    }
}
