api/models/vegetables_types.js
2018-09-07 21:14:05 +02:00

12 lines
327 B
JavaScript

module.exports = (sequelize, DataTypes) => {
const vegetableTypes = sequelize.define('vegetableTypes', {
name: DataTypes.STRING
}, {})
vegetableTypes.associate = function (models) {
vegetableTypes.hasMany(models.vegetables, {
as: 'Vegetables',
onDelete: 'cascade'
})
}
return vegetableTypes
}