13 lines
364 B
JavaScript
13 lines
364 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',
|
|
foreignKey: 'vegetableTypeId'
|
|
})
|
|
}
|
|
return vegetableTypes
|
|
}
|