api/models/vegetables_types.js

14 lines
364 B
JavaScript
Raw Normal View History

2018-09-07 21:14:05 +02:00
module.exports = (sequelize, DataTypes) => {
const vegetableTypes = sequelize.define('vegetableTypes', {
name: DataTypes.STRING
}, {})
vegetableTypes.associate = function (models) {
vegetableTypes.hasMany(models.vegetables, {
as: 'Vegetables',
2018-09-09 18:15:19 +02:00
onDelete: 'cascade',
foreignKey: 'vegetableTypeId'
2018-09-07 21:14:05 +02:00
})
}
return vegetableTypes
}