20190314084909_object_manager_attribute_date_remove_future_past.rb 599 B

123456789101112131415161718
  1. class ObjectManagerAttributeDateRemoveFuturePast < ActiveRecord::Migration[5.1]
  2. def change
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. ObjectManager::Attribute.where(data_type: 'date').each do |attribute|
  6. attribute.data_option = attribute.data_option.except(:future, :past)
  7. # some attributes from the early Zammad days don't have all
  8. # required data_option attributes because they were not properly migrated
  9. # so we need to fix them now
  10. attribute.data_option[:diff] ||= 24
  11. attribute.save!
  12. end
  13. end
  14. end