sql - 删除 Magento 中的所有客户

标签 sql magento

我需要从我的 Magento 安装中删除所有客户端,因为它们的日期不正确。我开发的网站中有 70,000 个客户。我怎样才能用 SQL 做到这一点?

最佳答案

首先进行备份并在开发服务器上进行测试! 这将删除包括日志在内的所有客户数据。

SET FOREIGN_KEY_CHECKS=0;
-- reset customers
TRUNCATE customer_address_entity;
TRUNCATE customer_address_entity_datetime;
TRUNCATE customer_address_entity_decimal;
TRUNCATE customer_address_entity_int;
TRUNCATE customer_address_entity_text;
TRUNCATE customer_address_entity_varchar;
TRUNCATE customer_entity;
TRUNCATE customer_entity_datetime;
TRUNCATE customer_entity_decimal;
TRUNCATE customer_entity_int;
TRUNCATE customer_entity_text;
TRUNCATE customer_entity_varchar;
TRUNCATE log_customer;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;

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

关于sql - 删除 Magento 中的所有客户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5271367/

相关文章:

sql - 如何使此查询也返回计数值为 0 的行?

c# - 如何在 HQL 中使用 DATEPART 从 DATETIME 获取 YEAR

php - Magento - 允许客户使用他们的 FedEx 帐户

css - 在 magento 中将 css 添加到仅来自 xml 的主页

magento - Magento 管理面板中系统配置的空白屏幕

php - 我需要验证信用卡详细信息

SQL 直方图 : Greater than 10 orders group as "10+ bucket"

sql - 如何检查ssis中的列结构?

android - 更新和删除用于填充 UI 的 sqlite 数据库

Magento:Storeview 访问