trabajo-afectivo/db/migrate/20190314084909_object_manager_attribute_date_remove_future_past.rb

13 lines
374 B
Ruby
Raw Normal View History

class ObjectManagerAttributeDateRemoveFuturePast < ActiveRecord::Migration[5.1]
def change
# return if it's a new setup
return if !Setting.find_by(name: 'system_init_done')
ObjectManager::Attribute.where(data_type: 'date').each do |attribute|
attribute.data_option = attribute.data_option.except(:future, :past)
attribute.save!
end
end
end