Implement cleanup method for Activity Stream

Idea created by Mark Willert on Dec 2, 2015



    as activity stream is a useful tool in SugarCRM 7, we saw that it could easily take more than 50% of the database size in productive instances. While this can be easily truncated from the database, this is not wanted by many customers.


    We also can delete all the entries in the activities table before a fixed date, but this also means losing all entries in the activity stream for older records.


    A method to to set time (eg. "older than 3/6/12 months") and a threshold how many entries for each record should stay ("do not delete the last 5 activity stream entries from a record") combined would be a useful tool for limiting DB usage. This could be a scheduler job running once a month or per quarter.