Commit 9a06dd4a authored by Andrew8xx8's avatar Andrew8xx8

Migrations added

parent 152c6018
class AddStateToUser < ActiveRecord::Migration
def change
add_column :users, :state, :string
end
end
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
class RemoveBlockedFromUser < ActiveRecord::Migration
def up
remove_column :users, :blocked
end
def down
add_column :users, :blocked, :boolean
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment