You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ho there, I am using bookshelf with registry plugin and I have the following model:
var bookshelf = require('../bin/database');
var cascadeDelete = require('bookshelf-cascade-delete');
I am trying to use cascade-delete but it gives me an error:
TypeError: Cannot read property 'column' of undefined
at Child.cascadeDelete (C:\Projects\copy\frozen-crawl\node_modules\bookshelf-cascade-delete\dist\index.js:95:54)
I guess it doesn't like the string in hasMany(). I have a ton of models using the registry plugin and I'll appreciate a way to make this work without having to modify all of them...
Thanks in advance...
EDIT: here is the route:
router.delete('/:id', function(req, res, next) {
Client
.forge({ id: req.body.id })
.destroy()
.then((deleted) => {
res.status(201).json({
message: 'Client deleted'
})
})
.catch(err => {
console.log(err);
res.status(500).json({
title: 'An error has occured',
error: err
})
});
})
The text was updated successfully, but these errors were encountered:
Ho there, I am using bookshelf with registry plugin and I have the following model:
var bookshelf = require('../bin/database');
var cascadeDelete = require('bookshelf-cascade-delete');
bookshelf.plugin(cascadeDelete);
bookshelf.plugin('registry');
var Client = bookshelf.Model.extend({
tableName: 'clients',
hasTimestamps: true,
}, {
dependents: ['users' ]
});
module.exports = bookshelf.model('Client', Client);
I am trying to use cascade-delete but it gives me an error:
TypeError: Cannot read property 'column' of undefined
at Child.cascadeDelete (C:\Projects\copy\frozen-crawl\node_modules\bookshelf-cascade-delete\dist\index.js:95:54)
I guess it doesn't like the string in hasMany(). I have a ton of models using the registry plugin and I'll appreciate a way to make this work without having to modify all of them...
Thanks in advance...
EDIT: here is the route:
router.delete('/:id', function(req, res, next) {
Client
.forge({ id: req.body.id })
.destroy()
.then((deleted) => {
res.status(201).json({
message: 'Client deleted'
})
})
.catch(err => {
console.log(err);
res.status(500).json({
title: 'An error has occured',
error: err
})
});
})
The text was updated successfully, but these errors were encountered: