Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Releases: PhilWaldmann/openrecord

Add migration helper

07 Mar 09:26

Choose a tag to compare

this.stampable()
this.polymorph(name)
this.nestedSet()

Full MySQL Support

06 Mar 19:59

Choose a tag to compare

v0.8.0

thanks for nothing

Migration bugfix

05 Mar 10:25

Choose a tag to compare

v0.7.5

fix migration default value bug

Relation bugfixes

03 Mar 22:03

Choose a tag to compare

v0.7.4

relation bugfixes

add this.autoJoin()

03 Mar 15:34

Choose a tag to compare

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

03 Mar 14:11

Choose a tag to compare

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

03 Mar 10:28

Choose a tag to compare

v0.7.1

Postgres: add time with(out) time zone

hasMany through relations

02 Mar 21:05

Choose a tag to compare

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

28 Feb 18:35

Choose a tag to compare

Cascade delete on relations

27 Feb 23:42

Choose a tag to compare

It's now possible do define a relation with the dependent options.
Possible values are:

  1. destroy: All related records will be destroyed. A destroy includes all hooks (beforeDestroy, afterDestroy)
  2. delete: All related record will be deleted. No hooks are fired!
  3. 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.