-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7a1dca
commit e69d084
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
db/migrate/20140913192733_add_trust_level_locked_column.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class AddTrustLevelLockedColumn < ActiveRecord::Migration | ||
def change | ||
add_column :users, :trust_level_locked, :boolean, { default: false, null: false} | ||
|
||
reversible do |dir| | ||
dir.up do | ||
# Populate the column | ||
execute <<-SQL | ||
UPDATE users | ||
SET trust_level_locked = 't' | ||
WHERE trust_level = 4 | ||
SQL | ||
end | ||
dir.down do | ||
# column is removed, no need to fill it | ||
end | ||
end | ||
end | ||
end |