You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 20160607055850_change_events_order_to_events_list_order.rb
    path of file: ./repos/huginn/db/migrate
    
    the code of the file until where you have to start completion: class ChangeEventsOrderToEventsListOrder < ActiveRecord::Migration[4.2]
  def up
    Agents::DataOutputAgent.find_each do |agent|
      if value = agent.options.delete('events_order')
        agent.options['events_list_order'] = value
        agent.save!(validate: false)
 
    
  def down
    Agents::DataOutputAgent.transaction do
      Agents::DataOutputAgent.find_each do |agent|
        if agent.options['events_order']
          raise ActiveRecord::IrreversibleMigration, "Cannot revert migration because events_order is configured"
        end

        if value = agent.options.delete('events_list_order')
          agent.options['events_order'] = value
          agent.save!(validate: false)
        end
      end