summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/migrate/20150113213922_remove_users_mail.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/db/migrate/20150113213922_remove_users_mail.rb b/db/migrate/20150113213922_remove_users_mail.rb
index 8a8b48429..81bbcf1b7 100644
--- a/db/migrate/20150113213922_remove_users_mail.rb
+++ b/db/migrate/20150113213922_remove_users_mail.rb
@@ -4,6 +4,10 @@ class RemoveUsersMail < ActiveRecord::Migration
end
def self.down
- raise IrreversibleMigration
+ add_column :users, :mail, :string, :limit => 60, :default => '', :null => false
+
+ EmailAddress.where(:is_default => true).each do |a|
+ User.where(:id => a.user_id).update_all(:mail => a.address)
+ end
end
end