Skip to content

Instantly share code, notes, and snippets.

@CNanninga
Created September 9, 2019 13:58
Show Gist options
  • Save CNanninga/d7a161df8d5ed1fbf5b7c2468c323d71 to your computer and use it in GitHub Desktop.
Save CNanninga/d7a161df8d5ed1fbf5b7c2468c323d71 to your computer and use it in GitHub Desktop.
Anonymize Magento 1 database
# 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');
# 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
UPDATE sales_flat_order_address AS tb SET tb.email = REPLACE (tb.email,(SUBSTRING_INDEX(SUBSTR(tb.email, INSTR(tb.email, '@') + 1),'.',5)), 'mailinator.com');
# Sales Flat Quotes
UPDATE sales_flat_quote AS tb SET tb.customer_email = REPLACE (tb.customer_email,(SUBSTRING_INDEX(SUBSTR(tb.customer_email, INSTR(tb.customer_email, '@') + 1),'.',5)), 'mailinator.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment