Setting up project
This commit is contained in:
parent
d07237cc6b
commit
a8dc7f8323
23 changed files with 6055 additions and 0 deletions
15
models/vegetables_pictures.js
Normal file
15
models/vegetables_pictures.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue