Skip to content

Need index to allow efficiently deleting notifications #32

@tspacek

Description

@tspacek
def destroy_singular_notifications(klass)
  klass.select('notify_user_notifications.*')
    .from("notify_user_notifications, to_json(notify_user_notifications.params -> 'user') user_entry")
    .where("user_entry ->> 'id' = ?", user.id).destroy_all
end

Need to be able to efficiently query on the subject of a notification, not just the target to whom the notification is sent. So that we can delete notifications for content that has been deleted or no longer warrants a notification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions