Add task to cleanup orphaned dossier_operation_logs
This commit is contained in:
parent
9b39934e8b
commit
d11cef6b0c
1 changed files with 17 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: destroy_orphaned_dossier_operation_logs'
|
||||||
|
task destroy_orphaned_dossier_operation_logs: :environment do
|
||||||
|
bar = RakeProgressbar.new(DossierOperationLog.count)
|
||||||
|
|
||||||
|
DossierOperationLog.find_each do |log|
|
||||||
|
if log.dossier.blank?
|
||||||
|
log.destroy
|
||||||
|
end
|
||||||
|
bar.inc
|
||||||
|
end
|
||||||
|
|
||||||
|
bar.finished
|
||||||
|
|
||||||
|
AfterParty::TaskRecord.create version: '20181128155650'
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue