After adding a check to enforce setting of a preferred patient identifier see
TRUNK-256, whenever a user edits a patient that has no preferred identifier, the patient validator rejects the patient. This will be frustrating to users each time they edit such patients, so we need to update all patients by setting a preferred identifier. There are 2 approaches(not limited to these) we have in mind:
a) Through a liquibase changeset that runs through all patients and sets a preferred identifier from the the collection of each patient's active identifiers.
b) Through a scheduled task that runs when upgrade is done since this wouldn't have the admin stuck on the upgrade page for implementations with a large number of patients
Things you might want to keep in mind:
1 - You can ignore voided patients and those with a preferred identifier(might be a harder SQL statement to write but should be possible) when fetching the patients from the database in case of option 'a'
2 - Make sure you are setting from active identifiers therefore ignore retired ones when fetching them from the database.
3 - If the option 'b' above is chosen, fetch patients in batches rather than all in one go to save memory.