-- Add pending_approval to the userstatus enum if it doesn't exist
DO $$
BEGIN
    IF NOT EXISTS (
        SELECT 1 FROM pg_enum 
        WHERE enumlabel = 'pending_approval' 
        AND enumtypid = (SELECT oid FROM pg_type WHERE typname = 'userstatus')
    ) THEN
        ALTER TYPE userstatus ADD VALUE 'pending_approval' BEFORE 'pre_approved';
    END IF;
END$$;
