Migrations added
This commit is contained in:
parent
152c6018b3
commit
9a06dd4aa1
5
db/migrate/20130304104623_add_state_to_user.rb
Normal file
5
db/migrate/20130304104623_add_state_to_user.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddStateToUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :state, :string
|
||||
end
|
||||
end
|
14
db/migrate/20130304104740_convert_blocked_to_state.rb
Normal file
14
db/migrate/20130304104740_convert_blocked_to_state.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
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(satate: :blocked).update_all(blocked: :true)
|
||||
end
|
||||
end
|
||||
end
|
9
db/migrate/20130304105317_remove_blocked_from_user.rb
Normal file
9
db/migrate/20130304105317_remove_blocked_from_user.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class RemoveBlockedFromUser < ActiveRecord::Migration
|
||||
def up
|
||||
remove_column :users, :blocked
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :users, :blocked, :boolean
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue