Forked from julienbourdeau/clean-prestashop-db.sql
Created
November 15, 2020 23:11
-
-
Save prestarocket/6c03c389b91f65b353a0ec552470805f to your computer and use it in GitHub Desktop.
Clean PrestaShop database - Drop old and unless data
This file contains hidden or 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'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment