Search code examples
mysqlmany-to-manynestjstypeormone-to-many

Relationship between User - calendar Many to many or one to Many


I have an application that needs to store calendar events for each user. One user can have many calendar events and One user can be an attendee to Many calendar events. Which I have created as below:

User: Id name .....

Calendar Id description start_date .... CreatedBy -> userID in user table Attendee -> userId in user table

My question does this effected table normalization. Would it be better to separate into a third table? Thanks


Solution

  • I don't understand completely what you are trying to do with

    CreatedBy -> userID in user table Attendee -> userId in user table

    Correct me if my model is wrong: model

    If you do that, it would not be possible for a user to be an attendee on many events. One user could have many events but could only be one attendee.

    So that would be the point where you need a third table because it doesn't work otherwise.