trabajo-afectivo/db/migrate/20210717101728_issue_3647_custom_object_attribute_integer.rb

18 lines
553 B
Ruby

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
class Issue3647CustomObjectAttributeInteger < ActiveRecord::Migration[6.0]
def up
return if !Setting.exists?(name: 'system_init_done')
%i[min max].each do |attr|
ObjectManager::Attribute
.where(data_type: 'integer', editable: true)
.each do |attribute|
next if attribute.data_option[attr] <= 2_147_483_647
attribute.data_option[attr] = 2_147_483_647
attribute.save!(validate: false)
end
end
end
end