-- drizzle/0016_restore_employees.sql
-- Emergency recovery: Restore employees with open employment periods

-- Reset archivedAt to NULL and isFired to false for employees with open employment periods
-- This restores employees who were incorrectly marked as fired/archived

UPDATE users
SET 
    archived_at = NULL,
    is_fired = false,
    updated_at = NOW()
WHERE id IN (
    SELECT user_id 
    FROM employment_periods 
    WHERE end_date IS NULL
);
