Setting 'min username length' greater than 5 breaks granting and revoking Admin/Moderator permissions

Long term I would prefer if we had a “validation” routine that runs every time you try to increase length for this key:

if min_user_name_length.increased? 
   if User.where('length(username) < :size', size: min_user_name_length).exists? 
     raise "sorry, but this is not gonna happen"
   end
    if Group.where('length(name) < :size', size: min_user_name_length).exists? 
     raise "sorry, but this is also not gonna happen"
   end
end
4 Likes