Created
March 25, 2016 12:58
-
-
Save joostvanveen/b56036370bf962e372ca to your computer and use it in GitHub Desktop.
Delete all products and categories from Magento 1.9.2
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
-- Foreign key check will cascade-delete all related data | |
-- Delete all products | |
DELETE FROM catalog_product_entity; | |
-- Reset the autoincrement for products | |
ALTER TABLE catalog_product_entity AUTO_INCREMENT = 1; | |
-- Delete all categories | |
DELETE FROM catalog_category_entity WHERE `entity_id` > 2; | |
-- Set the proper children_count for the two categories left | |
UPDATE catalog_category_entity SET children_count = 1 WHERE entity_id = 1; | |
UPDATE catalog_category_entity SET children_count = 0 WHERE entity_id = 2; | |
-- Reset the autoincrement for categories | |
ALTER TABLE catalog_category_entity AUTO_INCREMENT = 3; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment