@@ -1,9 +1,13 | |||||
1 | class RemoveUsersMail < ActiveRecord::Migration |
|
1 | class RemoveUsersMail < ActiveRecord::Migration | |
2 | def self.up |
|
2 | def self.up | |
3 | remove_column :users, :mail |
|
3 | remove_column :users, :mail | |
4 | end |
|
4 | end | |
5 |
|
5 | |||
6 | def self.down |
|
6 | def self.down | |
7 | raise IrreversibleMigration |
|
7 | add_column :users, :mail, :string, :limit => 60, :default => '', :null => false | |
|
8 | ||||
|
9 | EmailAddress.where(:is_default => true).each do |a| | |||
|
10 | User.where(:id => a.user_id).update_all(:mail => a.address) | |||
|
11 | end | |||
8 | end |
|
12 | end | |
9 | end |
|
13 | end |
General Comments 0
You need to be logged in to leave comments.
Login now