1234567891011121314151617181920 |
- class SlackGroupConfigIssue587 < ActiveRecord::Migration
- def up
- # return if it's a new setup
- return if !Setting.find_by(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
|