FIX: Query correct model in posts:inline_uploads (#18330)

Follow up to commit 9db8f00b3d.
This commit is contained in:
Bianca Nenciu 2022-09-23 15:00:02 +03:00 committed by GitHub
parent 42947ec6f1
commit 7d3e763f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -662,10 +662,7 @@ def correct_inline_uploads
dry_run = (ENV["DRY_RUN"].nil? ? true : ENV["DRY_RUN"] != "false")
verbose = ENV["VERBOSE"]
scope = Upload
.joins(:upload_references)
.where(upload_references: { target_type: 'Post' })
.distinct("posts.id")
scope = Post.joins(:upload_references).distinct("posts.id")
.where(<<~SQL)
raw LIKE '%/uploads/#{RailsMultisite::ConnectionManagement.current_db}/original/%'
SQL