Clean up Notifications

Hello everyone,
I now have a lot of notifications in mayan edms. I would like to clean them up, but you can only mark them as read. How do you delete old notifications?

Best regards, Jörg

Hello Jörg,

since there seems to be no built-in way in Mayan nor in the api, I think the only option is to delete them from the database.

:warning: Please note :warning:
I would like to point out that changing data directly in the database may destroy your DMS or may lead to unwanted behavior. Always backup your data before.

However, cou could use an SQL script like this.
Change the interval value as needed.

-- First, query for the records to delete and 
-- double check that the resulting records are correct.
SELECT *
FROM   messaging_message
WHERE  read=True AND date_time < now() - INTERVAL '30 days'
-- Then you can delete them
DELETE 
FROM   messaging_message
WHERE  read=True AND date_time < now() - INTERVAL '30 days'

Regards,
Torsten

2 Likes

@twp is spot on.

While the Notification objects are not a requirements for another object. There is a high chance that deleting them won’t cause major issues.

There is an item in the roadmap to address this and other event objects growth issues. No date for inclusion yet. We may be able to split the objective to get Notification deletion added sooner.

2 Likes

Hello Torsten,

Unfortunately, I am not very familiar with my SQL statements. That’s why I don’t want to try out the scripts. But Thank you very much for your help!!!

Roberto wrote below that there is a chance that the function for cleaning up notifications will be added soon with a bit of luck. I prefer to wait for the function in Mayan instead of experimenting with the scripts.

Br Joerg