Forums | Mahara Community
Support
/
Deletion of notification_internal_activity safe?
24 May 2022, 22:55
The DB table notification_internal_activity is constantly growing and due to some errors in the past, quite large in our instance. Is it safe to delete old entries (ranging from 2017-2021) or are there some primary/foreign key dependencies which would corrupt the database?
Thanks in advance and kind regards
Tobias
02 June 2022, 9:14
Hi Tobias,
The only issues that I can see with deleting line from 'notification_internal_activity' table are these:
1) These are the notices that people have in their 'inbox' and so deleting them can cause people to think messages have gone missing, eg their unread messages drop from 20 to 3 for example - so as long as you let the people know that older messages will be deleted that should be fine.
2) The only foreign key to worry about is the 'parent' field in 'notification_internal_activity' table - this is for nested message threads. So as long as the rows you are deleting are not the parent of rows you intend to leave then all should be fine.
A SQL query similar to this should help
SELECT id FROM notification_internal_activity WHERE id NOT IN ( SELECT parent FROM notification_internal_activity) AND ctime < '2021-01-01';
Cheers
Robert