Skip to content

Instantly share code, notes, and snippets.

@iacutone
Created July 24, 2014 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iacutone/465cbb44b17c3692fc2b to your computer and use it in GitHub Desktop.
Save iacutone/465cbb44b17c3692fc2b to your computer and use it in GitHub Desktop.
class DowncaseEmailAddresses < ActiveRecord::Migration
def up
# Downcase all User emails
User.update_all('email = LOWER(email)')
# Downcase all ContactRequest emails
ContactRequest.update_all('email_address = LOWER(email_address)')
# Downcase all Reservation emails
Reservation.update_all('renter_email = LOWER(renter_email)')
end
def down
raise ActiveRecord::IrreversibleMigration
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment