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>
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user