A mystery solved: the disappearing data
Posted by mholmes on 10 Feb 2011 in Activity log
We've had at least two occasions on which the data in the doc_to_docPeriod_id field was set to null unexpectedly. Today I finally figured out when it happens, which in turn enabled me to figure out how (with help from JN). It was triggered when I ran my script for copying the live data into the backup database. There was nothing in the script which did anything to explicitly delete data in the live db, though, so I was mystified, until JN suggested a trigger in one of the tables operating on the other. When I looked at the live db, I found there was indeed a foreign key which was pointing at the other database, by mistake. When the docPeriods table was truncated in the dev db, all the corresponding the live db was set to null. Doh!