Last active
October 2, 2019 08:27
-
-
Save hqmatics/6cce9ebb2f2f25f1a1a211c28ef915fd to your computer and use it in GitHub Desktop.
Clean PrestaShop database
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
# Delete all logs | |
TRUNCATE log; | |
# Delete old connection data (only used for stats) | |
DELETE c, cs | |
FROM connections c | |
LEFT JOIN connections_source cs ON (c.id_connections = cs.id_connections) | |
WHERE c.date_add < 'YYYY-MM-DD 00:00:00'; | |
OPTIMIZE TABLE connections, connections_source; | |
# Delete all guest without entry in customer table | |
DELETE g | |
FROM guest g | |
LEFT JOIN customer c ON (g.id_customer = c.id_customer) | |
WHERE c.id_customer IS NULL; | |
OPTIMIZE TABLE guest; | |
# 404 erors | |
DELETE FROM `pagenotfound` WHERE `date_add` < 'YYYY-MM-DD 00:00:00' ; | |
# Sent mails | |
DELETE FROM `mail` WHERE `date_add` < 'YYYY-MM-DD 00:00:00'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment