bookshelf-cascade-delete
bookshelf-cascade-delete copied to clipboard
Cascade delete many to many relations
I'm trying to delete all objects in the list, but only the support table and the news table itself are deleted
bookshelf.model('News', {
tableName: 'news',
files(){
return this.belongsToMany('Files').through('NewsFiles');
},
}, {
dependents: ['files']
});
delete:
await models.news.where({ id }).destroy({ cascadeDelete: true });
the files entry is not destroyed.