Verified in 184.108.40.206
the customer found that table "notification_recipients" also needs to be cleared.
psql -U postgres vmdb_production -c "DELETE FROM notifications n WHERE n.created_at < '$(date -u --date="1 day ago" +"%Y-%m-%d %H:%M")' AND n.notification_type_id IN ( SELECT nt.id FROM notification_types nt WHERE NOT nt.level='warning' AND NOT nt.level='error' );"
if this is correct, how can we clean it?
Hmm.... that is odd. I specifically covered that case in the changes.
You should be able to run the following though (NOT TESTED) and clear out the notification recipients related to the notification records as well:
DELETE FROM notification_recipients
WHERE notification_recipients.notification_id NOT IN (
SELECT id FROM notifications
Should delete all notification_recipients where the notification_id is now not present in the notifications table (was purged).
* * *
Can you tell me what version this is happening on? Might be related to the purging mixin code, and some of that extra functionality might have not made it in whatever version they are experiencing it on, so the associated records are not being deleted.
That said, I added tests around this specifically for Notification recipients, so it might be something else.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.