I'm new to database and i'm trying to implement relationships between tables.
I have two tables in my sql database which are equipment and equipmentType.
An equipment has only one equipmentType and there are lots of equipmentsTypes. But an equipmentType can be used in multiple equipments.
I'm in doubt if this is a one-to-one or one-to-many relationship. And how would I associate it with Sequelize.
CodePudding user response:
Equipment
and EquipmentType
is N:1 relationship. So it would look like this in Sequelize:
Equipment.belongsTo(EquipmentType)
EquipmentType.hasMany(Equipment)