Last active
May 20, 2018 04:45
-
-
Save evagabond/1a93ad0308392113960ef18ee6a4c0ef to your computer and use it in GitHub Desktop.
Delete Categories using phpMyAdmin in Magento 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
/* If you are using table_prefix in your DB | |
* do not forget to add them in the table names below prior to executing this code | |
*/ | |
SET FOREIGN_KEY_CHECKS = 0; | |
TRUNCATE TABLE catalog_category_entity; | |
TRUNCATE TABLE catalog_category_entity_datetime; | |
TRUNCATE TABLE catalog_category_entity_decimal; | |
TRUNCATE TABLE catalog_category_entity_int; | |
TRUNCATE TABLE catalog_category_entity_text; | |
TRUNCATE TABLE catalog_category_entity_varchar; | |
TRUNCATE TABLE catalog_category_product; | |
TRUNCATE TABLE catalog_category_product_index; | |
INSERT INTO `catalog_category_entity` (`entity_id`, `attribute_set_id`, `parent_id`, `created_at`, `updated_at`, `path`, `position`, `level`, `children_count`) VALUES ('1', '0', '0', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '1', '0', '0', '1'), | |
('2', '3', '1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '1/2', '1', '1', '0'); | |
INSERT INTO `catalog_category_entity_int` (`value_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES | |
('1', '69', '0', '1', '1'), | |
('2', '46', '0', '2', '1'), | |
('3', '69', '0', '2', '1'); | |
INSERT INTO `catalog_category_entity_varchar` (`value_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES | |
('1', '45', '0', '1', 'Root Catalog'), | |
('2', '45', '0', '2', 'Default Category'); | |
SET FOREIGN_KEY_CHECKS = 1; | |
DELETE FROM url_rewrite WHERE entity_type = 'category'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment