Last active
January 14, 2025 08:33
-
-
Save julienbourdeau/cca88e986a75e19488c2397f1386a3dc to your computer and use it in GitHub Desktop.
Clean PrestaShop database - Drop old and unless data
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 ps_log; | |
# Delete old connection data (only used for stats) | |
# change 2016-02-01 00:00:00 according to you needs | |
DELETE c, cs | |
FROM ps_connections c | |
LEFT JOIN ps_connections_source cs ON (c.id_connections = cs.id_connections) | |
WHERE c.date_add < '2016-02-01 00:00:00'; | |
OPTIMIZE TABLE ps_connections, ps_connections_source; | |
# Delete all guest without entry in ps_customer table | |
DELETE g | |
FROM ps_guest g | |
LEFT JOIN ps_customer c ON (g.id_customer = c.id_customer) | |
WHERE c.id_customer IS NULL; | |
OPTIMIZE TABLE ps_guest; | |
# Delete tables | |
# Scenes are deprecated in 1.6 (used only if upgrading with feature active) | |
DROP TABLE `ps_scene`; | |
DROP TABLE `ps_scene_category`; | |
DROP TABLE `ps_scene_lang`; | |
TRUNCATE `ps_scene_products`; | |
DROP TABLE `ps_scene_shop`; | |
UPDATE `ps_configuration` SET value='0', date_upd=NOW() WHERE `name` = 'PS_SCENE_FEATURE_ACTIVE'; |
curious, will deleting old carts of COMPLETED orders cause an error 500 opening the order should it ever be reviewed? Someone just asked me to help them remove all carts over 1 yr old.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have the same problem.