Skip to content

Instantly share code, notes, and snippets.

@hqmatics
Last active October 2, 2019 08:27
Show Gist options
  • Save hqmatics/6cce9ebb2f2f25f1a1a211c28ef915fd to your computer and use it in GitHub Desktop.
Save hqmatics/6cce9ebb2f2f25f1a1a211c28ef915fd to your computer and use it in GitHub Desktop.
Clean PrestaShop database
# 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