Skip to content

Instantly share code, notes, and snippets.

@joostvanveen
Created November 3, 2017 10:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joostvanveen/f2539dea22f56b6ea156571a28085977 to your computer and use it in GitHub Desktop.
Save joostvanveen/f2539dea22f56b6ea156571a28085977 to your computer and use it in GitHub Desktop.
Truncate all customers and their reviews from Magento 2
SET FOREIGN_KEY_CHECKS = 0;
-- TRUNCATE CUSTOMERS
TRUNCATE TABLE `PREFIX_customer_address_entity`;
TRUNCATE TABLE `PREFIX_customer_address_entity_datetime`;
TRUNCATE TABLE `PREFIX_customer_address_entity_decimal`;
TRUNCATE TABLE `PREFIX_customer_address_entity_int`;
TRUNCATE TABLE `PREFIX_customer_address_entity_text`;
TRUNCATE TABLE `PREFIX_customer_address_entity_varchar`;
TRUNCATE TABLE `PREFIX_customer_entity`;
TRUNCATE TABLE `PREFIX_customer_entity_datetime`;
TRUNCATE TABLE `PREFIX_customer_entity_decimal`;
TRUNCATE TABLE `PREFIX_customer_entity_int`;
TRUNCATE TABLE `PREFIX_customer_entity_text`;
TRUNCATE TABLE `PREFIX_customer_entity_varchar`;
TRUNCATE TABLE `PREFIX_customer_grid_flat`;
TRUNCATE TABLE `PREFIX_customer_log`;
TRUNCATE TABLE `PREFIX_customer_log`;
TRUNCATE TABLE `PREFIX_customer_visitor`;
TRUNCATE TABLE `PREFIX_persistent_session`;
TRUNCATE TABLE `PREFIX_wishlist`;
TRUNCATE TABLE `PREFIX_wishlist_item`;
TRUNCATE TABLE `PREFIX_wishlist_item_option`;
-- TRUNCATE REVIEWS
TRUNCATE TABLE `PREFIX_review`;
TRUNCATE TABLE `PREFIX_review_detail`;
TRUNCATE TABLE `PREFIX_review_entity_summary`;
TRUNCATE TABLE `PREFIX_review_store`;
SET FOREIGN_KEY_CHECKS = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment