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