summaryrefslogtreecommitdiff
path: root/lib/models/author.js
diff options
context:
space:
mode:
authorSheogorath2019-06-22 16:17:11 +0200
committerGitHub2019-06-22 16:17:11 +0200
commitfd2731042f958a34ff6aea5873275025d33a92e4 (patch)
treed9d6519bd418419d00bbad6a47e634a14bce9cd0 /lib/models/author.js
parent8612740f828a25a00df3aa5a16a9f9976f9d4a69 (diff)
parent63c96e7359fff1cbb6198ac0d684cff0cc675667 (diff)
Merge pull request #107 from SISheogorath/feature/db-upgrade
Fix sequelize by updating to the latest version
Diffstat (limited to 'lib/models/author.js')
-rw-r--r--lib/models/author.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/models/author.js b/lib/models/author.js
index 03f832a4..e65791cb 100644
--- a/lib/models/author.js
+++ b/lib/models/author.js
@@ -18,25 +18,25 @@ module.exports = function (sequelize, DataTypes) {
unique: true,
fields: ['noteId', 'userId']
}
- ],
- classMethods: {
- associate: function (models) {
- Author.belongsTo(models.Note, {
- foreignKey: 'noteId',
- as: 'note',
- constraints: false,
- onDelete: 'CASCADE',
- hooks: true
- })
- Author.belongsTo(models.User, {
- foreignKey: 'userId',
- as: 'user',
- constraints: false,
- onDelete: 'CASCADE',
- hooks: true
- })
- }
- }
+ ]
})
+
+ Author.associate = function (models) {
+ Author.belongsTo(models.Note, {
+ foreignKey: 'noteId',
+ as: 'note',
+ constraints: false,
+ onDelete: 'CASCADE',
+ hooks: true
+ })
+ Author.belongsTo(models.User, {
+ foreignKey: 'userId',
+ as: 'user',
+ constraints: false,
+ onDelete: 'CASCADE',
+ hooks: true
+ })
+ }
+
return Author
}