A platform for community discussion. Free, open, simple.
FIX: Don't count ignored, missing uploads in migration to S3
Gerhard Schlager0adab26e4546
diff --git a/lib/file_store/to_s3_migration.rb b/lib/file_store/to_s3_migration.rbindex 460a0112098..fe2edd5a535 100644--- a/lib/file_store/to_s3_migration.rb+++ b/lib/file_store/to_s3_migration.rb@@ -84,8 +84,20 @@ module FileStoreendDiscourse::Application.load_tasks- Rake::Task['posts:missing_uploads'].invoke('single_site')- count = PostCustomField.where(name: Post::MISSING_UPLOADS).count+ Rake::Task['posts:missing_uploads']+ count = DB.query_single(<<~SQL, Post::MISSING_UPLOADS, Post::MISSING_UPLOADS_IGNORED).first+ SELECT COUNT(1)+ FROM posts p+ WHERE EXISTS (+ SELECT 1+ FROM post_custom_fields f+ WHERE f.post_id = p.id AND f.name = ?+ ) AND NOT EXISTS (+ SELECT 1+ FROM post_custom_fields f+ WHERE f.post_id = p.id AND f.name = ?+ )+ SQLif count > 0error_message = "rake posts:missing_uploads identified #{count} issues. #{failure_message}"raise_or_log(error_message, should_raise)