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.11.0 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.10.3 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.10.2 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.10.1 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.10.0 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.9.2 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.9.1 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.9.0 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.8.2 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.8.1 db/migrate/20180801144544_add_type_to_messages.rb
hackathon_manager-0.8.0 db/migrate/20180801144544_add_type_to_messages.rb