I need a model to have an external_id field, but that id can come from different models.
For example I have a Customers model, and the customer can be either an organization or an invididual. The Organizations and Individuals models are obviously different, and I need to point to to either of those.
My idea would be to have an external_id field in Customers, and then a type field with that would allow me to point the external_id to the proper model.
Is this possible in Sequelize?
How would I define this relationship in Sequelize and query it afterwards?
via Pier
No comments:
Post a Comment