Commit 9a06dd4aa1ab008b6e12205ec3f8d00a50f79aa1
1 parent
152c6018
Exists in
master
and in
4 other branches
Migrations added
Showing
3 changed files
with
28 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,14 @@ | @@ -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 |