Upgrading from BASE 2 to BASE 3 may create duplicate file set members
|Reported by:||nicklas||Owned by:||everyone|
The upgrade will move all existing Image:s that has been added to a Scan into a FileSet as FileSetMember entries. In BASE 2 it is possible to have more than one image that points to the same file, but in BASE 3 this should not be possible. In a fresh BASE 3 installation this will never happen since there is a UNIQUE constraint on the (fileset_id, datafiletype_id, file_id) combination. When upgrading there are two problems:
- The UNIQUE constraint is not created
- There is no check for duplicate image files on the same scan
This may create a "dirty" BASE 3 database. It is not difficult to fix the upgrade program, but we also need to get rid of any duplicates that may have been added to an already upgraded server. Basically, we need to scan the database tables for updates and remove all but one of the duplicate rows. After that the UNIQUE index need to be created.