FIX: Don't count ignored, missing uploads in migration to S3
This commit is contained in:
parent
fb2fad4811
commit
0adab26e45
|
@ -84,8 +84,20 @@ module FileStore
|
||||||
end
|
end
|
||||||
|
|
||||||
Discourse::Application.load_tasks
|
Discourse::Application.load_tasks
|
||||||
Rake::Task['posts:missing_uploads'].invoke('single_site')
|
Rake::Task['posts:missing_uploads']
|
||||||
count = PostCustomField.where(name: Post::MISSING_UPLOADS).count
|
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 = ?
|
||||||
|
)
|
||||||
|
SQL
|
||||||
if count > 0
|
if count > 0
|
||||||
error_message = "rake posts:missing_uploads identified #{count} issues. #{failure_message}"
|
error_message = "rake posts:missing_uploads identified #{count} issues. #{failure_message}"
|
||||||
raise_or_log(error_message, should_raise)
|
raise_or_log(error_message, should_raise)
|
||||||
|
|
Loading…
Reference in New Issue