Sequelize.js delete query?
I've searched deep into the code, step by step into the following files:
https://github.com/sdepold/sequelize/blob/master/test/Model/destroy.js
https://github.com/sdepold/sequelize/blob/master/lib/model.js#L140
https://github.com/sdepold/sequelize/blob/master/lib/query-interface.js#L207-217
https://github.com/sdepold/sequelize/blob/master/lib/connectors/mysql/query-generator.js
What I found:
There isn't a deleteAll method, there's a destroy() method you can call on a record, for example:
Project.find(123).on('success', function(project) {
project.destroy().on('success', function(u) {
if (u && u.deletedAt) {
// successfully deleted the project
}
})
})
For anyone using Sequelize version 3 and above, use:
Model.destroy({
where: {
// criteria
}
})
Sequelize Documentation - Sequelize Tutorial