mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
FIX: Query correct model in posts:inline_uploads (#18330)
Follow up to commit 9db8f00b3dd6f2881adf1b786e29426889225e7a.
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user