BigW Consortium Gitlab

20130304104740_convert_blocked_to_state.rb 336 Bytes
Newer Older
Andrew8xx8 committed
1 2 3 4 5 6 7 8 9 10
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 committed
11
      User.where(state: :blocked).update_all(blocked: :true)
Andrew8xx8 committed
12 13 14
    end
  end
end