using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace foodmarket.Infrastructure.Persistence.Migrations
{
    /// <summary>Двухступенчатое удаление сотрудника: добавлены IsDeleted и
    /// DeletedAt. Ранее было только IsActive=false (увольнение); теперь:
    ///   IsActive=true                            — активный
    ///   IsActive=false  + FiredAt                — уволен
    ///   IsActive=false  + IsDeleted=true + DeletedAt — soft-deleted
    /// Физически Employee никогда не удаляем (FK из retail_sales, supplies).</summary>
    public partial class Phase5a_EmployeeSoftDelete : Migration
    {
        protected override void Up(MigrationBuilder b)
        {
            b.AddColumn<bool>(
                name: "IsDeleted",
                schema: "public",
                table: "employees",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            b.AddColumn<System.DateTime>(
                name: "DeletedAt",
                schema: "public",
                table: "employees",
                type: "timestamp with time zone",
                nullable: true);

            b.CreateIndex(
                name: "IX_employees_OrganizationId_IsDeleted",
                schema: "public",
                table: "employees",
                columns: new[] { "OrganizationId", "IsDeleted" });
        }

        protected override void Down(MigrationBuilder b)
        {
            b.DropIndex(name: "IX_employees_OrganizationId_IsDeleted", schema: "public", table: "employees");
            b.DropColumn(name: "IsDeleted",  schema: "public", table: "employees");
            b.DropColumn(name: "DeletedAt",  schema: "public", table: "employees");
        }
    }
}
