2018-09-07 21:14:05 +02:00
|
|
|
module.exports = (sequelize, DataTypes) => {
|
|
|
|
const vegetablePictures = sequelize.define('vegetablePictures', {
|
|
|
|
url: DataTypes.STRING,
|
|
|
|
order: DataTypes.INTEGER,
|
2018-09-16 23:46:39 +02:00
|
|
|
vegetableId: {
|
2018-09-07 21:14:05 +02:00
|
|
|
type: DataTypes.INTEGER,
|
|
|
|
references: 'vegetables',
|
|
|
|
referencesKey: 'id'
|
|
|
|
}
|
|
|
|
}, {})
|
2018-09-16 23:46:39 +02:00
|
|
|
vegetablePictures.associate = function(models) {
|
|
|
|
vegetablePictures.hasOne(models.vegetables, {
|
|
|
|
as: 'Vegetables',
|
|
|
|
foreignKey: 'id'
|
|
|
|
})
|
2018-09-07 21:14:05 +02:00
|
|
|
}
|
|
|
|
return vegetablePictures
|
|
|
|
}
|