Turn email addresses into fake addresses for testing databases
Snippet
Instead of being asleep at 16:42 on 12 October 2009, kitt created this:
When you have live data in a testing database, you don't want to trigger emails that go to your users. In the case where you need the rest of the data, and need valid email addresses, append .example.com to turn current valid email addresses into syntactically valid email addresses, but not emailable addresses.
UPDATE `orders` SET email = CONCAT(email, '.example.com') WHERE email NOT LIKE '%example.com'; -- alternately, to undo this change, use replace UPDATE `orders` SET email = REPLACE(email, '.example.com', '');
Add new comment