We have a number of places in the system we’re converting where we use and need composite primary keys. The first example I’m working on is our Patient --> Registration layer. Each patient can have from zero to infinity registrations (a normal master-detail type thing) - each registration is denoted by a date. There can only be one registration per date. We’ve handled this by having the PK for registration be patient_id + date.
I’ve been doing quite a bit of searching and all the references to composite keys go way back - 2015, 2016, and most of the latest around 2017. Many of them discouraged using composite keys at all, though the latest didn’t and suggested using an embedded type as the PK.
None of these examples showed a case where the composite PK also references a master (in this case patient).
Does such an example exist, or is there a newer, better way to do this?