I know this is a common question but i've done tests and i need some particular features!
The features i need are:
Optional features:
I've tested:
Right now i'm going to test JugglingDB and Bookshelf.js (but i don't like too much the last one).
Bookshelf should currently support all of those:
Definitely supports one model per file... the relations are defined in methods, so you can do:
var Classroom = Bookshelf.Model.extend({
tableName: 'classrooms',
student: function() {
// Relating to a model from a file in the same directory.
return this.hasMany(require('./student'));
}
});
new Classroom({id: 1})
.fetch({withRelated: ['students'])
.then(function(classroom) {
console.log(JSON.stringify(classroom));
});
Official soft delete support is in the works, but is definitely easily achieved by extending the model and providing a new destroy method like so:
destroy: function(options) {
if (options.softDelete) {
return this.save({'deleted_at': new Date});
}
return bookshelf.Model.prototype.destroy.call(this, arguments);
}
It doesn't hook into a cache yet, because cache invalidation on relations is pretty tricky, definitely something under consideration.
If you see anything that seems to be missing, feel free to open a ticket.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With