'Ternary relationship in sequelize - how should I do it

I have this ternary relationship: photo

I want to implement it into Sequelize but I couldn't find any docs on how to do it.

I was thinking about adding an ID field in ProfesoriClasa, then creating another pivot table, like this: photo

would this approach be fine? Or is there any other way to implement that ternary relationship using Sequelize?

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source