Sequelize model references vs associations

Using references you create a reference to another table, without adding any constraints, or associations. Which means that is just a way of signaling the database that this table has a reference to another.

Creating an association will add a foreign key constraint to the attributes. And the you can perform all the magic behind it the association functions. i.e User.getTasks();

More info about references here: https://sequelize.readthedocs.io/en/latest/docs/associations/#foreign-keys_1

About association here: http://docs.sequelizejs.com/manual/tutorial/associations.html

Leave a Comment

tech