Edit: OK I asked the wrong question here.
I'm going to be coding a stored proc that affects a lot of data, so I need to know the quickest, easiest way to roll back the data to the original state after I run a test.
Old question: I have a development database holding live data. This needs to be obfuscated for privacy, particularly company names and contact details.
To throw a spanner in the works the company NAME is the primary key. (.... yes, i know. legacy code. hooray.)
Now, I need to obfuscate the company name (say, change each to "Company 001" etc.) while preserving referential integrity with dozens of tables linked by this value. During my testing I'm going to mangle a lot of data, and then need to roll back to the original state after testing, probably many times before i get the procedure correct.
So the process will be:
- Mangle company data
- test within the application to ensure linked data displays correctly
- roll back data for bugfixes repeat
My initial thought is to simply back up and restore after each test. But this seems time consuming. Is there a better way?