I have a PostgreSQL database for representing relational data. In my case the tables are as follows:
- User: Basic user
- Issuer: Upgraded user
- Badge: Badge to issue, can only be created by issuer, and can be issued to any type of user
The relation between the tables are as follows:
- Issuer - User: one to one, basic info of issuers are held in User table, issuer related info are held in Issuer table
- Issuer - Badge: one to many, an issuer can create multiple unique badges
- Badge - User: many to many, one user can hold multiple diff. badges and a badge can be issued to multiple diff. users
- Should I combine User and Issuer tables into one and add a field to indicate the role of the user, or should I keep them separated? Note that Issuer has multiple fields that are unique to them (such as createdBadges). This way User will have both createdBadges and issuedBadges fields.
- Should I create separate table for indicating the relation between Badge and User called Issuances, or should I just have array references to each other?
I want better logical coherency, better management, and higher efficiency.