20170113000001_object_manager_attribute_create_middle.rb 661 B

123456789101112131415161718192021
  1. class ObjectManagerAttributeCreateMiddle < ActiveRecord::Migration
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. ObjectManager::Attribute.all.each { |attribute|
  6. next if attribute.name == 'tags'
  7. next if !attribute.screens
  8. next if !attribute.screens['create_bottom']
  9. attribute.screens['create_middle'] = attribute.screens['create_bottom']
  10. attribute.screens.delete('create_bottom')
  11. attribute.save!
  12. }
  13. attribute = ObjectManager::Attribute.find_by(name: 'priority_id')
  14. attribute.data_option['nulloption'] = false
  15. attribute.save!
  16. Cache.clear
  17. end
  18. end