Remove all test order customer and rewards and all


# stroe credit and return

"SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `mst_rewards_customer_referral_link`;
TRUNCATE TABLE `mst_rewards_earning_rule`;
TRUNCATE TABLE `mst_rma_attachment`;
TRUNCATE TABLE `mst_rewards_transaction`;
TRUNCATE TABLE `mst_rewards_spending_rule_website`;
TRUNCATE TABLE `mst_rewards_spending_rule_customer_group`;
TRUNCATE TABLE `mst_rewards_spending_rule`;
TRUNCATE TABLE `mst_rewards_referral`;
TRUNCATE TABLE `mst_rewards_purchase`;
TRUNCATE TABLE `mst_rewards_points_aggregated_hour`;
TRUNCATE TABLE `mst_rewards_notification_rule_website`;
TRUNCATE TABLE `mst_rewards_notification_rule_customer_group`;
TRUNCATE TABLE `mst_rewards_notification_rule`;
TRUNCATE TABLE `mst_rewards_earning_rule_website`;
TRUNCATE TABLE `mst_rewards_earning_rule_queue`;
TRUNCATE TABLE `mst_rewards_earning_rule_product`;
TRUNCATE TABLE `mst_rewards_earning_rule_customer_group`;
TRUNCATE TABLE `mst_rma_message`;
TRUNCATE TABLE `mst_rma_item`;
TRUNCATE TABLE `mst_rma_order_status_history`;
TRUNCATE TABLE `mst_rma_rma`;
SET FOREIGN_KEY_CHECKS = 1;"


# For Customer

SET FOREIGN_KEY_CHECKS=0;
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_visitor`;
SET FOREIGN_KEY_CHECKS=1;



# For order

SET FOREIGN_KEY_CHECKS=0;

# Clean order history
TRUNCATE TABLE `sales_bestsellers_aggregated_daily`;
TRUNCATE TABLE `sales_bestsellers_aggregated_monthly`;
TRUNCATE TABLE `sales_bestsellers_aggregated_yearly`;

# Clean order infos
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`;

# Clean cart infos
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`;

# Reset indexes (if you want your orders number start back to 1
TRUNCATE TABLE sequence_invoice_1;
TRUNCATE TABLE sequence_order_1;
TRUNCATE TABLE sequence_shipment_1;
TRUNCATE TABLE sequence_creditmemo_1;


SET FOREIGN_KEY_CHECKS=1;



Comments