Skip to content

Instantly share code, notes, and snippets.

@antoinekociuba
Created October 2, 2015 13:01
Show Gist options
  • Save antoinekociuba/c0a9091d6eb3b5982fb5 to your computer and use it in GitHub Desktop.
Save antoinekociuba/c0a9091d6eb3b5982fb5 to your computer and use it in GitHub Desktop.
Update customer/order email addresses in test environment database (prevent to accidentally send test emails to real customers)
## Update order email addresses ##
UPDATE `sales_flat_order`
SET `customer_email` = CONCAT('test__', `customer_email`)
WHERE `customer_email` NOT IN ('email@domain.com', 'email2@domain.com')
AND `customer_email` NOT LIKE 'test__%';
## Update customer email addresses ##
UPDATE `customer_entity`
SET `email` = CONCAT('test__', `email`)
WHERE `email` NOT IN ('email@domain.com', 'email2@domain.com')
AND `email` NOT LIKE 'test__%';
@jigneshthummar
Copy link

How about newsletter subscribers?


UPDATE `newsletter_subscriber`
SET `subscriber_email` = CONCAT('test__', `subscriber_email`)
WHERE `subscriber_email` NOT IN ('email@domain.com', 'email2@domain.com')
AND `subscriber_email` NOT LIKE 'test__%';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment