20130126080736_change_memory_to_long_text.rb 588 B

123456789101112131415161718192021
  1. # PG allows arbitrarily long text fields but MySQL has default limits. Make those limits larger if we're using MySQL.
  2. class ChangeMemoryToLongText < ActiveRecord::Migration
  3. def up
  4. if mysql?
  5. change_column :agents, :memory, :text, :limit => 4294967295
  6. change_column :events, :payload, :text, :limit => 16777215
  7. end
  8. end
  9. def down
  10. if mysql?
  11. change_column :agents, :memory, :text, :limit => 65535
  12. change_column :events, :payload, :text, :limit => 65535
  13. end
  14. end
  15. def mysql?
  16. ActiveRecord::Base.connection.adapter_name =~ /mysql/i
  17. end
  18. end