Created
November 14, 2016 11:24
-
-
Save carlowens/4200fb3f827440fe1ec26ea700899e2d to your computer and use it in GitHub Desktop.
Magento 2 remove test data of orders and customers
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
SET FOREIGN_KEY_CHECKS = 0; | |
#clear orders | |
TRUNCATE TABLE `gift_message`; | |
TRUNCATE TABLE `quote`; | |
TRUNCATE TABLE `quote_address`; | |
TRUNCATE TABLE `quote_address_item`; | |
TRUNCATE TABLE `quote_id_mask`; | |
TRUNCATE TABLE `quote_item`; | |
TRUNCATE TABLE `quote_item_option`; | |
TRUNCATE TABLE `quote_payment`; | |
TRUNCATE TABLE `quote_shipping_rate`; | |
TRUNCATE TABLE `reporting_orders`; | |
TRUNCATE TABLE `sales_bestsellers_aggregated_daily`; | |
TRUNCATE TABLE `sales_bestsellers_aggregated_monthly`; | |
TRUNCATE TABLE `sales_bestsellers_aggregated_yearly`; | |
TRUNCATE TABLE `sales_creditmemo`; | |
TRUNCATE TABLE `sales_creditmemo_comment`; | |
TRUNCATE TABLE `sales_creditmemo_grid`; | |
TRUNCATE TABLE `sales_creditmemo_item`; | |
TRUNCATE TABLE `sales_invoice`; | |
TRUNCATE TABLE `sales_invoiced_aggregated`; | |
TRUNCATE TABLE `sales_invoiced_aggregated_order`; | |
TRUNCATE TABLE `sales_invoice_comment`; | |
TRUNCATE TABLE `sales_invoice_grid`; | |
TRUNCATE TABLE `sales_invoice_item`; | |
TRUNCATE TABLE `sales_order`; | |
TRUNCATE TABLE `sales_order_address`; | |
TRUNCATE TABLE `sales_order_aggregated_created`; | |
TRUNCATE TABLE `sales_order_aggregated_updated`; | |
TRUNCATE TABLE `sales_order_grid`; | |
TRUNCATE TABLE `sales_order_item`; | |
TRUNCATE TABLE `sales_order_payment`; | |
TRUNCATE TABLE `sales_order_status_history`; | |
TRUNCATE TABLE `sales_order_tax`; | |
TRUNCATE TABLE `sales_order_tax_item`; | |
TRUNCATE TABLE `sales_payment_transaction`; | |
TRUNCATE TABLE `sales_refunded_aggregated`; | |
TRUNCATE TABLE `sales_refunded_aggregated_order`; | |
TRUNCATE TABLE `sales_shipment`; | |
TRUNCATE TABLE `sales_shipment_comment`; | |
TRUNCATE TABLE `sales_shipment_grid`; | |
TRUNCATE TABLE `sales_shipment_item`; | |
TRUNCATE TABLE `sales_shipment_track`; | |
TRUNCATE TABLE `sales_shipping_aggregated`; | |
TRUNCATE TABLE `sales_shipping_aggregated_order`; | |
TRUNCATE TABLE `tax_order_aggregated_created`; | |
TRUNCATE TABLE `tax_order_aggregated_updated`; | |
#clear customers | |
TRUNCATE TABLE `customer_address_entity`; | |
TRUNCATE TABLE `customer_address_entity_datetime`; | |
TRUNCATE TABLE `customer_address_entity_decimal`; | |
TRUNCATE TABLE `customer_address_entity_int`; | |
TRUNCATE TABLE `customer_address_entity_text`; | |
TRUNCATE TABLE `customer_address_entity_varchar`; | |
TRUNCATE TABLE `customer_entity`; | |
TRUNCATE TABLE `customer_entity_datetime`; | |
TRUNCATE TABLE `customer_entity_decimal`; | |
TRUNCATE TABLE `customer_entity_int`; | |
TRUNCATE TABLE `customer_entity_text`; | |
TRUNCATE TABLE `customer_entity_varchar`; | |
TRUNCATE TABLE `customer_grid_flat`; | |
TRUNCATE TABLE `customer_log`; | |
TRUNCATE TABLE `customer_log`; | |
TRUNCATE TABLE `customer_visitor`; | |
TRUNCATE TABLE `persistent_session`; | |
TRUNCATE TABLE `wishlist`; | |
TRUNCATE TABLE `wishlist_item`; | |
TRUNCATE TABLE `wishlist_item_option`; | |
#clear reviews | |
TRUNCATE TABLE `review`; | |
TRUNCATE TABLE `review_detail`; | |
TRUNCATE TABLE `review_entity_summary`; | |
TRUNCATE TABLE `review_store`; |
thanks for sharing.
SET FOREIGN_KEY_CHECKS = 1;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You missed a few tables:
catalog_compare_item
downloadable_link_purchased
downloadable_link_purchased_item
newsletter_queue_link
newsletter_subscriber
paypal_billing_agreement
paypal_billing_agreement_order
paypal_payment_transaction
paypal_settlement_report
paypal_settlement_report_row
product_alert_price
product_alert_stock
rating_option_vote
rating_option_vote_aggregated
report_compared_product_index
report_viewed_product_aggregated_daily
report_viewed_product_aggregated_monthly
report_viewed_product_aggregated_yearly
report_viewed_product_index
salesrule_coupon_aggregated
salesrule_coupon_aggregated_order
salesrule_coupon_aggregated_updated
salesrule_coupon_usage
salesrule_customer
vault_payment_token
vault_payment_token_order_payment_link