From b9175b58776ff21bc24439f4a9d8553955ebf5f9 Mon Sep 17 00:00:00 2001 From: Sojan Date: Tue, 9 Aug 2022 16:57:35 +0200 Subject: [PATCH] chore: migration to remove stale data --- app/jobs/migration/remove_stale_notifications_job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/migration/remove_stale_notifications_job.rb b/app/jobs/migration/remove_stale_notifications_job.rb index 27a055d0d..0727e6843 100644 --- a/app/jobs/migration/remove_stale_notifications_job.rb +++ b/app/jobs/migration/remove_stale_notifications_job.rb @@ -12,7 +12,7 @@ class Migration::RemoveStaleNotificationsJob < ApplicationJob def remove_conversation_notifications deleted_ids = [] Notification.where(primary_actor_type: 'Conversation').pluck(:primary_actor_id).uniq.each_slice(1000) do |id_list| - deleted_ids << id_list - Conversation.where(id: id_list).pluck(:id) + deleted_ids << (id_list - Conversation.where(id: id_list).pluck(:id)) end Notification.where(primary_actor_type: 'Conversation', primary_actor_id: deleted_ids).destroy_all end @@ -20,7 +20,7 @@ class Migration::RemoveStaleNotificationsJob < ApplicationJob def remove_message_notifications deleted_ids = [] Notification.where(primary_actor_type: 'Message').pluck(:primary_actor_id).uniq.each_slice(1000) do |id_list| - deleted_ids << id_list - Message.where(id: id_list).pluck(:id) + deleted_ids << (id_list - Message.where(id: id_list).pluck(:id)) end Notification.where(primary_actor_type: 'Message', primary_actor_id: deleted_ids).destroy_all end