· 9 years ago · Jan 27, 2017, 09:54 PM
1-- After dumping a production database, needing to scrub customer data to remove emails, phone numbers,
2-- reset passwords, and/or specific attributes from the EAV tables. Change IDs and values accordingly
3-- DO NOT BLINDLY COPY/PASTE RUN without customizing for your needs first! For Magento 1.x
4
5-- NOTE: if you need to target a specific EAV use something similar and NOTE the attribute_id!
6update customer_entity_text set value = concat('test+unknown@gmail.com') where attribute_id = 267 and entity_type_id = 1;
7
8-- Set all customer passwords to password123
9update customer_entity_varchar set value = '15d590025cf0bc5c7db18292ca8c73342d3a7706f0deb5589431e3a137b420cf:jK' where attribute_id = 12 and entity_type_id = 1;
10
11-- set all email addresses
12update customer_entity set email = concat('test+', entity_id, '@gmail.com');
13update sales_flat_order_address set email = concat('test+', customer_id, '@gmail.com') where customer_id is not null;
14update sales_flat_order_address set email = concat('test+unknown@gmail.com') where customer_id is null;
15update sales_flat_order set customer_email = concat('test+', customer_id, '@gmail.com') where customer_id is not null;
16update sales_flat_order set customer_email = concat('test+unknown@gmail.com') where customer_id is null;
17update sales_flat_quote set customer_email = concat('test+', customer_id, '@gmail.com') where customer_id is not null;
18update sales_flat_quote set customer_email = concat('test+unknown@gmail.com') where customer_id is null;
19update sales_flat_quote_address set email = concat('test+', customer_id, '@gmail.com') where customer_id is not null;
20update sales_flat_quote_address set email = concat('test+unknown@gmail.com') where customer_id is null;
21
22-- set all phone numbers
23update customer_address_entity_varchar set value = '15551231234' where attribute_id = 31 and entity_type_id = 2;
24update sales_flat_order_address set telephone = '15551231234' where customer_id is not null;
25update sales_flat_order_address set telephone = '15551231234' where customer_id is null;
26update sales_flat_quote_address set telephone = '15551231234' where customer_id is not null;
27update sales_flat_quote_address set telephone = '15551231234' where customer_id is null;