clean(data): remove old cron UpdateAdministrateurUsageStatisticsJob from delayed job table

This commit is contained in:
Martin 2022-05-17 06:07:55 +02:00 committed by mfo
parent 185f2acdea
commit 863358f389

View file

@ -0,0 +1,14 @@
namespace :after_party do
desc 'Deployment task: remove_old_cron_job_from_delayed_job_table'
task remove_old_cron_job_from_delayed_job_table: :environment do
puts "Running deploy task 'remove_old_cron_job_from_delayed_job_table'"
cron = Delayed::Job.where.not(cron: nil)
.where("handler LIKE ?", "%UpdateAdministrateurUsageStatisticsJob%")
.first
cron.destroy if cron
AfterParty::TaskRecord
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
end
end