How to model relationshipMappings for two tables that have multiple relations with each other (e.g. first many-to-many and second one-to-many)? #2554
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have two tables, User and Song, and these tables have two relationships between them. First relationship is many-to-many which creates a virtual table called UserSongsRating with an extra attribute and the second relationship is one-to-many, with the foreign key of User being in the Song (representation of the artist). How do I define these in the relationshipMappings?
My initial idea is to create a new Model for UserSongsRating so that the relations are seperated, is this correct or is there a built-in way in objection.js for this situation?
Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions