module.exports = (sequelize, DataTypes) => { const vegetablePictures = sequelize.define('vegetablePictures', { url: DataTypes.STRING, order: DataTypes.INTEGER, vegetableId: { type: DataTypes.INTEGER, references: 'vegetables', referencesKey: 'id' } }, {}) vegetablePictures.associate = function(models) { vegetablePictures.hasOne(models.vegetables, { as: 'Vegetables', foreignKey: 'id' }) } return vegetablePictures }