summaryrefslogtreecommitdiffstats
path: root/db/migrate/20150113213922_remove_users_mail.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-03-07 16:14:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-03-07 16:14:41 +0000
commit0965aafd51bb3cd0284f3e31e566b53574a87dd6 (patch)
tree8ec9429ab5d912284ff4b93d7ed1175294e4904a /db/migrate/20150113213922_remove_users_mail.rb
parentb1c0c690c0af875dc6ebd5b38915193b8d33e5c1 (diff)
downloadredmine-0965aafd51bb3cd0284f3e31e566b53574a87dd6.tar.gz
redmine-0965aafd51bb3cd0284f3e31e566b53574a87dd6.zip
Change 20150113213922_remove_users_mail.rb from Irreversible to Reversible (#19233).
git-svn-id: http://svn.redmine.org/redmine/trunk@14052 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate/20150113213922_remove_users_mail.rb')
-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