From 37dad46629d21dba05892c0051f3f8cac2ca66c0 Mon Sep 17 00:00:00 2001 From: Urban Rotnik Date: Thu, 18 Feb 2021 14:40:32 +0100 Subject: [PATCH] Add cleanup workflow images task SCI-5500 --- lib/tasks/data.rake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index 7ec3468a2..32335818c 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -151,4 +151,14 @@ namespace :data do end end end + + desc 'Purge all experiment workflow images' + task purge_experiment_workflow_images: :environment do + ActiveStorage::Attachment.where(name: 'workflowimg').delete_all + end + + desc 'Purge all experiment workflow images' + task cleanup_blobs: :environment do + ActiveStorage::Blob.unattached.find_each(&:purge_later) + end end