trabajo-afectivo/db/migrate/20170113000002_slack_group_config_issue_587.rb

25 lines
645 B
Ruby
Raw Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
2017-09-08 08:28:34 +00:00
class SlackGroupConfigIssue587 < ActiveRecord::Migration[4.2]
def up
# return if it's a new setup
return if !Setting.exists?(name: 'system_init_done')
setting = Setting.find_by(name: 'slack_config')
return if !setting
return if !setting.state_current['value']
return if !setting.state_current['value']['items']
config_item = setting.state_current['value']['items'].first
return if !config_item
return if !config_item.key?('group_id')
config_item['group_ids'] = config_item.delete('group_id')
setting.save!
end
end