Commit 9a06dd4aa1ab008b6e12205ec3f8d00a50f79aa1

Authored by Andrew8xx8
1 parent 152c6018

Migrations added

db/migrate/20130304104623_add_state_to_user.rb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +class AddStateToUser < ActiveRecord::Migration
  2 + def change
  3 + add_column :users, :state, :string
  4 + end
  5 +end
... ...
db/migrate/20130304104740_convert_blocked_to_state.rb 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +class ConvertBlockedToState < ActiveRecord::Migration
  2 + def up
  3 + User.transaction do
  4 + User.where(blocked: true).update_all(state: :blocked)
  5 + User.where(blocked: false).update_all(state: :active)
  6 + end
  7 + end
  8 +
  9 + def down
  10 + User.transaction do
  11 + User.where(satate: :blocked).update_all(blocked: :true)
  12 + end
  13 + end
  14 +end
... ...
db/migrate/20130304105317_remove_blocked_from_user.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +class RemoveBlockedFromUser < ActiveRecord::Migration
  2 + def up
  3 + remove_column :users, :blocked
  4 + end
  5 +
  6 + def down
  7 + add_column :users, :blocked, :boolean
  8 + end
  9 +end
... ...