Sha256: f57c5ea0fec7c5b0f686ed8fed2890db09975d5b23eee770c062fd675d8643ec

Contents?: true

Size: 376 Bytes

Versions: 31

Compression:

Stored size: 376 Bytes

Contents

class AddTypeToMessages < ActiveRecord::Migration[5.1]
  def up
    add_column :messages, :type, :string

    Message.all.each do |message|
      if message.trigger.present?
        message.update_attribute(:type, 'automated')
      else
        message.update_attribute(:type, 'bulk')
      end
    end
  end

  def down
    remove_column :messages, :type, :string
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
hackathon_manager-0.14.1 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.14.0 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.12 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.11 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.10 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.9 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.8 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.7 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.6 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.5 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.4 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.3 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.2 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.1 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.13.0 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.12.2 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.12.1 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.12.0 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.11.2 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.11.1 db/migrate/20180801144544_add_type_to_messages.rb