using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SolutionErp.Infrastructure.Persistence.Migrations
{
    /// <inheritdoc />
    public partial class FilterHrmCatalogUniqueIndexesByIsDeleted : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_ShiftPatterns_Code",
                table: "ShiftPatterns");

            migrationBuilder.DropIndex(
                name: "IX_OtPolicies_Code",
                table: "OtPolicies");

            migrationBuilder.DropIndex(
                name: "IX_LeaveTypes_Code",
                table: "LeaveTypes");

            migrationBuilder.CreateIndex(
                name: "IX_ShiftPatterns_Code",
                table: "ShiftPatterns",
                column: "Code",
                unique: true,
                filter: "[IsDeleted] = 0");

            migrationBuilder.CreateIndex(
                name: "IX_OtPolicies_Code",
                table: "OtPolicies",
                column: "Code",
                unique: true,
                filter: "[IsDeleted] = 0");

            migrationBuilder.CreateIndex(
                name: "IX_LeaveTypes_Code",
                table: "LeaveTypes",
                column: "Code",
                unique: true,
                filter: "[IsDeleted] = 0");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_OtPolicies_Code",
                table: "OtPolicies");

            migrationBuilder.DropIndex(
                name: "IX_LeaveTypes_Code",
                table: "LeaveTypes");

            migrationBuilder.CreateIndex(
                name: "IX_ShiftPatterns_Code",
                table: "ShiftPatterns",
                column: "Code",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_OtPolicies_Code",
                table: "OtPolicies",
                column: "Code",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_LeaveTypes_Code",
                table: "LeaveTypes",
                column: "Code",
                unique: true);
        }
    }
}
