20220517065751_issue4086_fix_historical_options.rb 556 B

123456789101112131415
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue4086FixHistoricalOptions < ActiveRecord::Migration[6.1]
  3. def change
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. ObjectManager::Attribute.find_each do |attribute|
  7. next if !%r{^(multi|tree_)?select$}.match?(attribute.data_type)
  8. attribute.data_option[:historical_options] = ObjectManager::Attribute.data_options_hash(attribute.data_option[:historical_options] || {})
  9. attribute.save
  10. end
  11. end
  12. end