diff options
author | Sheogorath | 2018-05-25 14:54:00 +0200 |
---|---|---|
committer | Sheogorath | 2018-05-25 14:55:18 +0200 |
commit | 408ab7ae1dfa5d1c7dedb2f9fde239596520b2e6 (patch) | |
tree | 65efa501b128c268497e9bf226a9f1332d8c8e48 /lib/models/note.js | |
parent | 8aa5c03213fb8809c4d41f95ee6b8d8e2967812a (diff) |
Use cascaded deletes
When we delete a user we should delete all the notes that belong to this
user including the revisions of these notes.
Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
Diffstat (limited to 'lib/models/note.js')
-rw-r--r-- | lib/models/note.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/models/note.js b/lib/models/note.js index 7b9a909a..7d8e9625 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -91,7 +91,9 @@ module.exports = function (sequelize, DataTypes) { Note.belongsTo(models.User, { foreignKey: 'ownerId', as: 'owner', - constraints: false + constraints: false, + onDelete: 'CASCADE', + hooks: true }) Note.belongsTo(models.User, { foreignKey: 'lastchangeuserId', |