require 'build'
require 'build_attempt'

class RenameErrorStateToErrored < ActiveRecord::Migration
  def self.up
    BuildAttempt.update_all({:state => 'errored'}, {:state => 'error'})
    Build.update_all({:state => 'errored'}, {:state => 'error'})
  end

  def self.down
    BuildAttempt.update_all({:state => 'error'}, {:state => 'errored'})
    Build.update_all({:state => 'error'}, {:state => 'errored'})
  end
end

class RenameErrorStateToErrored < ActiveRecord::Migration
  def self.up
    execute("UPDATE build_attempts SET state='errored' WHERE state='error'")
    execute("UPDATE builds SET state='errored' WHERE state='error'")
  end

  def self.down
    execute("UPDATE builds SET state='error' WHERE state='errored'")
    execute("UPDATE build_attempts SET state='error' WHERE state='errored'")
  end
end

Fix update_all syntax for Rails 4.1
Fix update_all syntax for Rails 4.1

In this case, just switch to pure SQL for infinite compatibility
