summaryrefslogtreecommitdiff
path: root/db/migrate/20130304104740_convert_blocked_to_state.rb
blob: 9afd109364520073016a09b509528af7747b33dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# rubocop:disable all
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
      User.where(state: :blocked).update_all(blocked: :true)
    end
  end
end