trabajo-afectivo/db/migrate/20220517065751_issue4086_fix_historical_options.rb

16 lines
556 B
Ruby
Raw Permalink Normal View History

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