diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-01-17 14:14:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-01-17 14:14:12 +0000 |
commit | e3618bdbecd9b5d86eb6d2c8c256ba3fcdf05189 (patch) | |
tree | 3b54c10eecece6cc2674491a76a4e5e932d82d1e /db/migrate/20150113211532_populate_email_addresses.rb | |
parent | 7f29c2fd88f271ac59f1c10b90942fec57b35ae2 (diff) | |
download | redmine-e3618bdbecd9b5d86eb6d2c8c256ba3fcdf05189.tar.gz redmine-e3618bdbecd9b5d86eb6d2c8c256ba3fcdf05189.zip |
Add support for multiple email addresses per user (#4244).
git-svn-id: http://svn.redmine.org/redmine/trunk@13886 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate/20150113211532_populate_email_addresses.rb')
-rw-r--r-- | db/migrate/20150113211532_populate_email_addresses.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/db/migrate/20150113211532_populate_email_addresses.rb b/db/migrate/20150113211532_populate_email_addresses.rb new file mode 100644 index 000000000..80a5fb016 --- /dev/null +++ b/db/migrate/20150113211532_populate_email_addresses.rb @@ -0,0 +1,14 @@ +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 |