Skip to content

Instantly share code, notes, and snippets.

View mhhansen's full-sized avatar

Martin Hansen mhhansen

  • Buenos Aires, Argentina
View GitHub Profile
@mhhansen
mhhansen / magento-1-anonymize-db.sql
Last active November 12, 2019 21:14
Magento 1 - Anonymize db
# Customers
UPDATE customer_entity AS tb SET tb.email = CONCAT('customer', tb.entity_id, '@mailinator.com');
# Newsletter Subscribers
UPDATE newsletter_subscriber AS tb SET tb.subscriber_email = REPLACE (tb.subscriber_email,(SUBSTRING_INDEX(SUBSTR(tb.subscriber_email, INSTR(tb.subscriber_email, '@') + 1),'.',5)), 'mailinator.com');
# Sales Flat Orders
UPDATE sales_flat_order AS tb SET tb.customer_email = REPLACE (tb.customer_email,(SUBSTRING_INDEX(SUBSTR(tb.customer_email, INSTR(tb.customer_email, '@') + 1),'.',5)), 'mailinator.com');
# Sales Flat Orders Address
@mhhansen
mhhansen / magento-2-anonymize-db.sql
Last active April 30, 2021 07:04
Magento 2 - anonymize db
-- Admin emails
UPDATE admin_user AS tb SET tb.email = CONCAT('customer', tb.user_id, '@mailinator.com');
-- Customers
UPDATE customer_entity AS tb SET tb.email = CONCAT('customer', tb.entity_id, '@mailinator.com');
-- Customers Grid
UPDATE customer_grid_flat AS tb SET tb.email = CONCAT('customer', tb.entity_id, '@mailinator.com');
-- Newsletter Subscribers