trabajo-afectivo/db/migrate/20220127135317_scheduler_updates2.rb
2022-01-27 15:21:35 +01:00

26 lines
686 B
Ruby

# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
class SchedulerUpdates2 < ActiveRecord::Migration[6.0]
def change
return if !Setting.exists?(name: 'system_init_done')
schedulers_update = [
{
name: "Clean up 'Cti::Log'.",
method: 'Cti::Log.cleanup',
},
]
schedulers_update.each do |scheduler|
fetched_scheduler = Scheduler.find_by(method: scheduler[:method])
next if !fetched_scheduler
if scheduler[:name]
# p "Updating name of #{scheduler[:name]} to #{scheduler[:name]}"
fetched_scheduler.name = scheduler[:name]
end
fetched_scheduler.save!
end
end
end