One of the programs we're working on is growing and we're at a stage where we can revisit the existing database and spend time 'trying to get it right'. One of the things we're looking at is the data model and how we model 'parties' among other things. We have made do until now with determining customer details from transaction records, but now we want to store more detail and would like to combine the common data we have for staff, suppliers and members, etc.
Each party is either an individual or a group, but can also have one or more roles such as employer, client, member, etc. I realise that various parties in our model don't exist without a relationship to another party (staff need an employer, a customer needs a company to buy from, members need a club, etc) and since I don't want people to add silly relationships like 'employer-client' or 'member-subcontractor', I now have a table called relationship
which predefines which roles can go with each other. I haven't seen this before and I wonder, are we on the right track? (Here is a simplified EER diagram to show how we think this might be represented)
I have looked at various documentation on the principles of the party model, but I haven't been able to find any (open source) examples of how it actually looks in pratice. Can anyone recommend a source (preferably in MySQL) or share your experience on how to implement it, perhaps with the table structure or application code?