From 19a9cf3d2fe201b8bead84f5567926ff63eddfe0 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 7 Feb 2022 14:44:23 -0600 Subject: [PATCH] uploads: delete old upload records from before the rework. Delete all old upload records from before the upload rework in abdab7a0a / f11c46b4f. Uploads from before the rework don't have any attached media assets, so they're not valid under the new system because we can't find which files they were for. Before the rework, completed uploads were only saved for 1 hour, and failed uploads were only saved for 3 days, so deleting this data doesn't really lose anything that wouldn't have been deleted before. --- script/fixes/099_delete_old_uploads.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 script/fixes/099_delete_old_uploads.rb diff --git a/script/fixes/099_delete_old_uploads.rb b/script/fixes/099_delete_old_uploads.rb new file mode 100755 index 000000000..5688d4655 --- /dev/null +++ b/script/fixes/099_delete_old_uploads.rb @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby + +require_relative "base" + +with_confirmation do + # Delete all old upload records from before the upload rework in abdab7a0a / f11c46b4f. + Upload.where("uploads.id <= 4974361").where.missing(:upload_media_assets).delete_all +end