mirror da
https://github.com/redmine/redmine.git
synced 2024-08-27 05:58:46 +02:00
![Jean-Philippe Lang](/assets/img/avatar_default.png)
git-svn-id: http://svn.redmine.org/redmine/trunk@13886 e93f8b46-1217-0410-a6f0-8f06a7374b81
15 righe
499 B
Ruby
15 righe
499 B
Ruby
class PopulateEmailAddresses < ActiveRecord::Migration
|
|
def self.up
|
|
t = EmailAddress.connection.quoted_true
|
|
n = EmailAddress.connection.quoted_date(Time.now)
|
|
|
|
sql = "INSERT INTO #{EmailAddress.table_name} (user_id, address, is_default, notify, created_on, updated_on)" +
|
|
" SELECT id, mail, #{t}, #{t}, '#{n}', '#{n}' FROM #{User.table_name} WHERE type = 'User' ORDER BY id"
|
|
EmailAddress.connection.execute(sql)
|
|
end
|
|
|
|
def self.down
|
|
EmailAddress.delete_all
|
|
end
|
|
end
|