20140603104211_rename_digest_email_to_email_digest.rb 726 B

123456789101112131415161718192021
  1. class RenameDigestEmailToEmailDigest < ActiveRecord::Migration
  2. def up
  3. sql = <<-SQL
  4. UPDATE #{ActiveRecord::Base.connection.quote_table_name('agents')}
  5. SET #{ActiveRecord::Base.connection.quote_column_name('type')} = 'Agents::EmailDigestAgent'
  6. WHERE #{ActiveRecord::Base.connection.quote_column_name('type')} = 'Agents::DigestEmailAgent'
  7. SQL
  8. execute sql
  9. end
  10. def down
  11. sql = <<-SQL
  12. UPDATE #{ActiveRecord::Base.connection.quote_table_name('agents')}
  13. SET #{ActiveRecord::Base.connection.quote_column_name('type')} = 'Agents::DigestEmailAgent'
  14. WHERE #{ActiveRecord::Base.connection.quote_column_name('type')} = 'Agents::EmailDigestAgent'
  15. SQL
  16. execute sql
  17. end
  18. end