20130304104740_convert_blocked_to_state.rb 358 Bytes
Newer Older
1
# rubocop:disable all
Andrew8xx8's avatar
Andrew8xx8 committed
2 3 4 5 6 7 8 9 10 11
class ConvertBlockedToState < ActiveRecord::Migration
  def up
    User.transaction do
      User.where(blocked: true).update_all(state: :blocked)
      User.where(blocked: false).update_all(state: :active)
    end
  end

  def down
    User.transaction do
Andrew8xx8's avatar
Andrew8xx8 committed
12
      User.where(state: :blocked).update_all(blocked: :true)
Andrew8xx8's avatar
Andrew8xx8 committed
13 14 15
    end
  end
end