mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Add a where clause to join to NotificationHistory, this is some extra assurance that the Notification will not be deleted unless the history exists.
This commit is contained in:
@@ -344,7 +344,8 @@ def _delete_notifications(
|
||||
).filter(
|
||||
Notification.notification_type == notification_type,
|
||||
Notification.service_id == service_id,
|
||||
Notification.created_at < date_to_delete_from
|
||||
Notification.created_at < date_to_delete_from,
|
||||
NotificationHistory.id == Notification.id
|
||||
).limit(query_limit).subquery()
|
||||
|
||||
number_deleted = db.session.query(Notification).filter(
|
||||
|
||||
Reference in New Issue
Block a user