I want to properly setup one-to-one or one-to-many relationship with sequelize and as a matter of fact it all seems to be working just fine if i use either one of hasOne/ hasMany or belongsTo in my model definition.
For example the following associations do create the userId field on their Targets:
User.hasMany(Email, {
as: 'emails',
foreignKey: 'userId',
})
User.hasOne(Profile, {
as: 'profile',
foreignKey: 'userId',
})
But almost everywhere in official docs i see something like:
Projects.hasMany(Tasks);
Tasks.belongsTo(Projects);
i.e. hasMany AND belongsTo are being used together.
Is this really required or it is enough to use just one of them? Any further explanation would be really valuable. Thanks!