5👍
✅
Just create another table in the database, and move messages there. For example:
Run CREATE TABLE emails_archive LIKE emails;
in MySQL.
Then put into the daily cron this job:
INSERT INTO emails_archive (SELECT * FROM emails WHERE sent_at < DATE_SUB(NOW(), 1 MONTH));
DELETE FROM emails WHERE sent_at < DATE_SUB(NOW(), 1 MONTH));
That is it!
Source:stackexchange.com