diff --git a/app/jobs/migration/remove_stale_notifications_job.rb b/app/jobs/migration/remove_stale_notifications_job.rb index bceecfcbe..fcd8bee8d 100644 --- a/app/jobs/migration/remove_stale_notifications_job.rb +++ b/app/jobs/migration/remove_stale_notifications_job.rb @@ -10,7 +10,8 @@ class Migration::RemoveStaleNotificationsJob < ApplicationJob def remove_invalid_messages deleted_ids = [] - Message.distinct.pluck(:inbox_id).each_slice(1000) do |id_list| + + Message.unscoped.distinct.pluck(:inbox_id).each_slice(1000) do |id_list| deleted_ids << (id_list - Inbox.where(id: id_list).pluck(:id)) end