]>
Commit | Line | Data |
---|---|---|
feb4bdfd C |
1 | module.exports = function (sequelize, DataTypes) { |
2 | const Author = sequelize.define('Author', | |
3 | { | |
4 | name: { | |
5 | type: DataTypes.STRING | |
6 | } | |
7 | }, | |
8 | { | |
9 | classMethods: { | |
10 | associate | |
11 | } | |
12 | } | |
13 | ) | |
14 | ||
15 | return Author | |
16 | } | |
17 | ||
18 | // --------------------------------------------------------------------------- | |
19 | ||
20 | function associate (models) { | |
21 | this.belongsTo(models.Pod, { | |
22 | foreignKey: { | |
23 | name: 'podId', | |
24 | allowNull: true | |
25 | }, | |
26 | onDelete: 'cascade' | |
27 | }) | |
28 | } |