FIX: Query correct model in posts:inline_uploads (#18330)
Follow up to commit 9db8f00b3d
.
This commit is contained in:
parent
42947ec6f1
commit
7d3e763f01
|
@ -662,10 +662,7 @@ def correct_inline_uploads
|
||||||
dry_run = (ENV["DRY_RUN"].nil? ? true : ENV["DRY_RUN"] != "false")
|
dry_run = (ENV["DRY_RUN"].nil? ? true : ENV["DRY_RUN"] != "false")
|
||||||
verbose = ENV["VERBOSE"]
|
verbose = ENV["VERBOSE"]
|
||||||
|
|
||||||
scope = Upload
|
scope = Post.joins(:upload_references).distinct("posts.id")
|
||||||
.joins(:upload_references)
|
|
||||||
.where(upload_references: { target_type: 'Post' })
|
|
||||||
.distinct("posts.id")
|
|
||||||
.where(<<~SQL)
|
.where(<<~SQL)
|
||||||
raw LIKE '%/uploads/#{RailsMultisite::ConnectionManagement.current_db}/original/%'
|
raw LIKE '%/uploads/#{RailsMultisite::ConnectionManagement.current_db}/original/%'
|
||||||
SQL
|
SQL
|
||||||
|
|
Loading…
Reference in New Issue