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