Created
February 2, 2021 11:00
-
-
Save sebastian-fahrenkrog/bc61310b64ab63b5745cb38e1d81c73e to your computer and use it in GitHub Desktop.
Mautic Database Cleanup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove unused ips | |
php app/console mautic:unusedip:delete -n --limit=99999999999 | |
# Maintenance cleanup | |
php app/console mautic:maintenance:cleanup --days-old=21 -n | |
Mysql: | |
#infos: https://github.com/mautic/mautic/issues/7763 | |
UPDATE email_stats SET tokens = NULL; | |
UPDATE email_stats SET open_details = NULL; | |
UPDATE email_stats SET last_opened = NULL; | |
TRUNCATE TABLE notifications; | |
# Important: Free up storage space | |
OPTIMIZE LOCAL TABLE page_hits; | |
OPTIMIZE LOCAL TABLE audit_log; | |
OPTIMIZE LOCAL TABLE email_stats; | |
OPTIMIZE LOCAL TABLE notifications; | |
OPTIMIZE LOCAL TABLE campaign_lead_event_log; | |
OPTIMIZE LOCAL TABLE lead_event_log; | |
OPTIMIZE LOCAL TABLE ip_addresses; | |
OPTIMIZE LOCAL TABLE lead_ips_xref; | |
Optional: | |
DELETE FROM campaign_lead_event_log WHERE date_triggered < (NOW() - INTERVAL 60 DAY); | |
UPDATE campaign_lead_event_log SET metadata = ''; | |
DELETE from lead_event_log where bundle="lead" and object="import" WHERE date_added < (NOW() - INTERVAL 30 DAY); | |
OPTIMIZE LOCAL TABLE campaign_lead_event_log; | |
OPTIMIZE LOCAL TABLE lead_event_log; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment