2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-31 12:06:56 +08:00
|
|
|
class SplitAliasLevels < ActiveRecord::Migration[4.2]
|
2017-08-29 01:26:03 +08:00
|
|
|
def up
|
2017-08-29 00:32:08 +08:00
|
|
|
add_column :groups, :messageable_level, :integer, default: 0
|
2017-08-29 01:26:03 +08:00
|
|
|
add_column :groups, :mentionable_level, :integer, default: 0
|
2017-08-29 00:32:08 +08:00
|
|
|
|
2017-08-29 01:26:03 +08:00
|
|
|
execute 'UPDATE groups SET messageable_level = alias_level, mentionable_level = alias_level'
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
raise ActiveRecord::IrreversibleMigration
|
2017-08-29 00:32:08 +08:00
|
|
|
end
|
|
|
|
end
|