mantisbt/mantisbt — pull request #309 by grangeway (2014-09-13 17:57:54+00:00)
Title: Remove references to duplicate_id where appropriate.

This field was mainly deprecated in a previous release.

However, from looking back, I can't see us actually doing a schema update when changing this functionality so attempt to tidy up now from history entries:

New Schema Updates:

Schema 204: Function - check duplicate ids. This looks for any bugs where duplicate id is >0. If it's found, we look for a relationship indicating the duplicate. If found, remove duplicate_id from bug. If not found, check bug history table for th missing relationship link.
Note: If after this, the number of bugs with a duplicate_id is greater then 0, return a schema failure for now. We need to decide what to actually do here if a bug has a duplicate_id set, and there's no record of it in relationship or history tables.

Schema 205: Try to convert the old duplicate_id history field to relationship-duplicate fields. Look to see if bug_relationship exists, and if so, delete the duplicate id. After that, look for add/remove bugs.
Note: same logic here - if any else has gone on, abort the update so we can think about the data set :/

Schema 206: Remove obsolete duplicate_id field.

Note:
a) The above should only be a possible issue for old data sets [pre-dating 1.0.0] i.e. >12 year old instances
b) Part of the reason for trying to tidy this up is that bug_copy for one was still setting the the duplicate_id field even though we dont use it - therefore there is potential data in the field.