29th / personnel-v3

Personnel management system version 3
https://www.29th.org
2 stars 6 forks source link

Normalise email addresses in users table #255

Open wilson29thid opened 6 months ago

wilson29thid commented 6 months ago

For any kind of future matching—or for former members who have never joined discourse and one day decide to—emails are first converted to lowercase before being compared. So we should make sure all emails in the members table are lowercase.

A quick data migration with something like this should do the trick.

User.find_each do |legacy_user|
  legacy_user.normalize_attribute(:email)
  legacy_user.save
end