defer drop alias_level
This commit is contained in:
parent
fa69e0dd77
commit
e282f10d94
|
@ -7,8 +7,8 @@ Group.where(name: 'everyone').update_all(visibility_level: Group.visibility_leve
|
|||
|
||||
ColumnDropper.drop(
|
||||
table: 'groups',
|
||||
after_migration: 'RemovePublicFromGroups',
|
||||
columns: %w[visible public],
|
||||
after_migration: 'SplitAliasLevels',
|
||||
columns: %w[visible public alias_level],
|
||||
on_drop: ->() {
|
||||
STDERR.puts 'Removing superflous visible group column!'
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
class SplitAliasLevels < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :groups, :alias_level, :mentionable_level
|
||||
def up
|
||||
add_column :groups, :messageable_level, :integer, default: 0
|
||||
add_column :groups, :mentionable_level, :integer, default: 0
|
||||
|
||||
Group.update_all('messageable_level=mentionable_level')
|
||||
execute 'UPDATE groups SET messageable_level = alias_level, mentionable_level = alias_level'
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue