chore: migration to remove stale data
This commit is contained in:
parent
267b19db3d
commit
b9175b5877
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue