This probably just dates back to the fact that “location behavior” was a later addition to patient identifiers–it used to that the locations were always required, and we added “location behavior” to support making it not required. Assumedly when the “location_behavior” column was added to patient_identiifer_type, for backwards compatibility it was decided that the simplest option was to make it nullable but have null = required. Other option would have been to make it “not null” but when adding the column setting all all existing rows to “required”.
I would think we should have had a database migration set it to required for everything, and disallow null/blank. I don’t know what actually happened though.
I am working on the TRUNK-4847. As a part of this ticket, I guess we need to add NOT NULL constraint to the location_behavior column of patient_identifier_type table.
But I should make sure this change should not disturb the work done on TRUNK-427.
I request some senior dev go through this commit and confirm
Based on TRUNK-427, it looks like we initially wanted three types of location behaviors (REQUIRED, NOT USED & OPTIONAL). I guess that during implementation it became clear that we didn’t really need OPTIONAL.
We should probably ask @mseaton for input and maybe to do the review.