Wednesday 20 January 2016

Sequelize.js Model Question: HasOne Entity1 OR Entity2?

Hello all,Sequelize.js question here.I'm trying to define my models here, and I have one table (the Users) which has a field for realWorldID. This ID will either contain the realworldID of userType1 or userType2. (The userTypes are contained within two tables because only a subset of one type will be users, and each userType holds different data).Usually if it were only associating a User with one userType, I would be able to do: User.HasOne(userType1)But what I want to do is essentially User.HasOne(userType1 OR userType2)Is there any way to do this?

Submitted January 20, 2016 at 09:12PM by TLI5

No comments:

Post a Comment