Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joostvanveen/b56036370bf962e372ca to your computer and use it in GitHub Desktop.
Save joostvanveen/b56036370bf962e372ca to your computer and use it in GitHub Desktop.
Delete all products and categories from Magento 1.9.2
-- 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