This repository was archived by the owner on Aug 5, 2021. It is now read-only.
Releases: PhilWaldmann/openrecord
Releases · PhilWaldmann/openrecord
Add migration helper
this.stampable()
this.polymorph(name)
this.nestedSet()
Full MySQL Support
v0.8.0 thanks for nothing
Migration bugfix
v0.7.5 fix migration default value bug
Relation bugfixes
v0.7.4 relation bugfixes
add this.autoJoin()
You can define this.autoJoin(); inside your model definition and execute find queries without calling join('relation'). Every .where({relation:{field:'value'}}) condition will result in a join.
add paranoid plugin
Just add this.paranoid(); into your models definition to destroy records paranoid.
This works only with a column deleted_at
Postgres add 'time with(out) time zone' type
v0.7.1 Postgres: add time with(out) time zone
hasMany through relations
it's now possible to add the following:
store.Model('User', function(){
this.hasMany('posts');
this.hasMany('threads');
this.hasMany('unread_posts');
this.hasMany('unread', {through:'unread_posts'});
this.hasMany('unread_threads', {through:'unread', relation:'thread'});
});
store.Model('Post', function(){
this.belongsTo('user');
this.belongsTo('thread');
});
store.Model('Thread', function(){
this.belongsTo('user');
this.hasMany('posts');
});
store.Model('UnreadPost', function(){
this.belongsTo('user');
this.belongsTo('unread', {model: 'Post'});
});and do joins or includes via
User.join({threads:{user:'unread_threads'}}).where({threads:{user:{unread_threads:{title_like:'my thread title'}}}}).order('users.id').exec(function(result){
//...
});Fixed a race condition with delete_all, destroy_all and update_all
v0.6.1 Race condition bugfix
Cascade delete on relations
It's now possible do define a relation with the dependent options.
Possible values are:
destroy: All related records will be destroyed. A destroy includes all hooks (beforeDestroy,afterDestroy)delete: All related record will be deleted. No hooks are fired!nullify: Works only on hasMany(). The foreign key of all related records will be set to null.
There are also new methods on the Model:
delete_all(callback): Deletes all matching records. (No hooks)
destroy_all(callback): Destroys all matching records.
update_all(attributes, callback): Update all matching records.