sql 从Magento中删除所有客户和销售数据。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 从Magento中删除所有客户和销售数据。相关的知识,希望对你有一定的参考价值。

SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE sales_flat_quote;
TRUNCATE TABLE sales_flat_quote_item;
TRUNCATE TABLE sales_flat_quote_address;
TRUNCATE TABLE sales_flat_quote_address_item;
TRUNCATE TABLE sales_flat_quote_item_option;
TRUNCATE TABLE sales_flat_quote_payment;
TRUNCATE TABLE sales_flat_quote_shipping_rate;
TRUNCATE TABLE sales_flat_order;
TRUNCATE TABLE sales_flat_order_grid;
TRUNCATE TABLE sales_flat_order_item;
TRUNCATE TABLE sales_flat_order_address;
TRUNCATE TABLE sales_flat_order_payment;
TRUNCATE TABLE sales_flat_order_status_history;
TRUNCATE TABLE sales_flat_invoice;
TRUNCATE TABLE sales_flat_invoice_grid;
TRUNCATE TABLE sales_flat_invoice_item;
TRUNCATE TABLE sales_flat_invoice_comment;
TRUNCATE TABLE sales_flat_shipment;
TRUNCATE TABLE sales_flat_shipment_grid;
TRUNCATE TABLE sales_flat_shipment_item;
TRUNCATE TABLE sales_flat_shipment_comment;
TRUNCATE TABLE sales_flat_shipment_track;
TRUNCATE TABLE sales_flat_creditmemo;
TRUNCATE TABLE sales_flat_creditmemo_grid;
TRUNCATE TABLE sales_flat_creditmemo_item;
TRUNCATE TABLE sales_flat_creditmemo_comment;
TRUNCATE TABLE sales_recurring_profile;
TRUNCATE TABLE sales_recurring_profile_order;
TRUNCATE TABLE sales_order_tax;


TRUNCATE TABLE sales_order_aggregated_created;
TRUNCATE TABLE sales_order_aggregated_updated;
TRUNCATE TABLE sales_shipping_aggregated;
TRUNCATE TABLE sales_shipping_aggregated_order;
TRUNCATE TABLE sales_invoiced_aggregated;
TRUNCATE TABLE sales_invoiced_aggregated_order;
TRUNCATE TABLE sales_refunded_aggregated;
TRUNCATE TABLE sales_refunded_aggregated_order;
TRUNCATE TABLE sales_payment_transaction;
TRUNCATE TABLE sales_bestsellers_aggregated_daily;
TRUNCATE TABLE sales_bestsellers_aggregated_monthly;
TRUNCATE TABLE sales_bestsellers_aggregated_yearly;
TRUNCATE TABLE sales_billing_agreement                    ;
TRUNCATE TABLE sales_billing_agreement_order;
TRUNCATE TABLE downloadable_link_purchased;
TRUNCATE TABLE downloadable_link_purchased_item;
TRUNCATE TABLE eav_entity_store;
TRUNCATE TABLE sales_order_tax;
TRUNCATE TABLE sales_order_tax_item;
TRUNCATE TABLE log_quote;
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 log_customer;
TRUNCATE TABLE log_visitor;
TRUNCATE TABLE log_visitor_info;


ALTER TABLE sales_flat_quote AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_address AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_address_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_item_option AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_payment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_shipping_rate AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_grid AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_address AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_payment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_status_history AUTO_INCREMENT=1;
ALTER TABLE sales_flat_invoice AUTO_INCREMENT=1;
ALTER TABLE sales_flat_invoice_grid AUTO_INCREMENT=1;
ALTER TABLE sales_flat_invoice_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_invoice_comment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment_grid AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment_comment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment_track AUTO_INCREMENT=1;
ALTER TABLE sales_flat_creditmemo AUTO_INCREMENT=1;
ALTER TABLE sales_flat_creditmemo_grid AUTO_INCREMENT=1;
ALTER TABLE sales_flat_creditmemo_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_creditmemo_comment AUTO_INCREMENT=1;
ALTER TABLE sales_recurring_profile AUTO_INCREMENT=1;
ALTER TABLE sales_recurring_profile_order AUTO_INCREMENT=1;
ALTER TABLE sales_order_tax AUTO_INCREMENT=1;

ALTER TABLE sales_order_aggregated_created AUTO_INCREMENT=1;
ALTER TABLE sales_order_aggregated_updated AUTO_INCREMENT=1;
ALTER TABLE sales_shipping_aggregated AUTO_INCREMENT=1;
ALTER TABLE sales_shipping_aggregated_order AUTO_INCREMENT=1;
ALTER TABLE sales_invoiced_aggregated AUTO_INCREMENT=1;
ALTER TABLE sales_invoiced_aggregated_order AUTO_INCREMENT=1;
ALTER TABLE sales_refunded_aggregated AUTO_INCREMENT=1;
ALTER TABLE sales_refunded_aggregated_order AUTO_INCREMENT=1;
ALTER TABLE sales_payment_transaction AUTO_INCREMENT=1;
ALTER TABLE sales_bestsellers_aggregated_daily AUTO_INCREMENT=1;
ALTER TABLE sales_bestsellers_aggregated_monthly AUTO_INCREMENT=1;
ALTER TABLE sales_bestsellers_aggregated_yearly AUTO_INCREMENT=1;
ALTER TABLE sales_billing_agreement                     AUTO_INCREMENT=1;
ALTER TABLE sales_billing_agreement_order AUTO_INCREMENT=1;
ALTER TABLE downloadable_link_purchased AUTO_INCREMENT=1;
ALTER TABLE downloadable_link_purchased_item AUTO_INCREMENT=1;
ALTER TABLE eav_entity_store AUTO_INCREMENT=1;
ALTER TABLE sales_order_tax AUTO_INCREMENT=1;
ALTER TABLE sales_order_tax_item AUTO_INCREMENT=1;
ALTER TABLE log_quote AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_datetime AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_decimal AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_int AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_text AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_varchar AUTO_INCREMENT=1;
ALTER TABLE customer_entity AUTO_INCREMENT=1;
ALTER TABLE customer_entity_datetime AUTO_INCREMENT=1;
ALTER TABLE customer_entity_decimal AUTO_INCREMENT=1;
ALTER TABLE customer_entity_int AUTO_INCREMENT=1;
ALTER TABLE customer_entity_text AUTO_INCREMENT=1;
ALTER TABLE customer_entity_varchar AUTO_INCREMENT=1;
ALTER TABLE log_customer AUTO_INCREMENT=1;
ALTER TABLE log_visitor AUTO_INCREMENT=1;
ALTER TABLE log_visitor_info AUTO_INCREMENT=1;

TRUNCATE `log_customer`;
ALTER TABLE `log_customer` AUTO_INCREMENT=1;
TRUNCATE `log_quote`;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;
TRUNCATE `log_summary`;
ALTER TABLE `log_summary` AUTO_INCREMENT=1;
TRUNCATE `log_visitor_info`;
ALTER TABLE `log_visitor_info` AUTO_INCREMENT=1;
TRUNCATE `log_url`;
ALTER TABLE `log_url` AUTO_INCREMENT=1;
TRUNCATE `log_url_info`;
ALTER TABLE `log_url_info` AUTO_INCREMENT=1;
TRUNCATE `log_visitor`;
ALTER TABLE `log_visitor` AUTO_INCREMENT=1;
TRUNCATE `report_event`;
ALTER TABLE `report_event` AUTO_INCREMENT=1;
TRUNCATE `log_summary_type`;
ALTER TABLE `log_summary_type` AUTO_INCREMENT=1;

SET FOREIGN_KEY_CHECKS=1;

以上是关于sql 从Magento中删除所有客户和销售数据。的主要内容,如果未能解决你的问题,请参考以下文章

sql Magento - 删除所有客户

Magento 2从数据库中删除内联转换

sql Magento:从商店中删除所有类别

sql sql获取magento 2中的所有销售订单备注

Magento:删除产品特价“从”和“到”日期要求

sql 清除所有Magento 1.9。*客户/订单数据