add back column temporarily to make deployment smoother

This commit is contained in:
Sam Saffron 2017-07-04 10:31:10 -04:00
parent b8b4970481
commit d0d60af510
2 changed files with 16 additions and 0 deletions

View File

@ -4,3 +4,12 @@ if g = Group.find_by(name: 'trust_level_5', id: 15)
end
Group.where(name: 'everyone').update_all(visibility_level: Group.visibility_levels[:owners])
ColumnDropper.drop(
table: 'groups',
after_migration: 'AddVisibleBackToGroups',
columns: %w[visible],
on_drop: ->(){
STDERR.puts 'Removing superflous visible group column!'
}
)

View File

@ -0,0 +1,7 @@
class AddVisibleBackToGroups < ActiveRecord::Migration
def change
# add the visible column so it is delay dropped this cleans up some deploy issues
add_column :groups, :visible, :boolean, default: true, null: false
execute 'UPDATE groups set visible = false where visibility_level > 0'
end
end