const { DataTypes } = require('sequelize'); module.exports = (sequelize) => { const Position = sequelize.define('Position', { caption: { type: DataTypes.STRING, allowNull: false } }, { tableName: 'positions', timestamps: false }); Position.associate = function(models) { Position.belongsToMany(models.ContactPerson, { through: models.ContactPersonPosition, foreignKey: 'position_id', otherKey: 'contact_person_id', as: 'contactPersons' }); }; return Position; };