Skip to content

Instantly share code, notes, and snippets.

@nntoan
Forked from antoinekociuba/update_emails.sql
Created March 23, 2016 07:38
Show Gist options
  • Save nntoan/55bdaeffda7099eb9e1d to your computer and use it in GitHub Desktop.
Save nntoan/55bdaeffda7099eb9e1d 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__%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment