20170113000001_object_manager_attribute_create_middle.rb 753 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class ObjectManagerAttributeCreateMiddle < ActiveRecord::Migration[4.2]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. ObjectManager::Attribute.all.each do |attribute|
  7. next if attribute.name == 'tags'
  8. next if !attribute.screens
  9. next if !attribute.screens['create_bottom']
  10. attribute.screens['create_middle'] = attribute.screens['create_bottom']
  11. attribute.screens.delete('create_bottom')
  12. attribute.save!
  13. end
  14. attribute = ObjectManager::Attribute.find_by(name: 'priority_id')
  15. attribute.data_option['nulloption'] = false
  16. attribute.save!
  17. Rails.cache.clear
  18. end
  19. end