knex-model
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -60,2 +60,13 @@ 'use strict'; | ||
Relation.prototype.update = function(params) { | ||
if(this.type !== 'hasOne') { | ||
throw new Error('not support update on `' + this.type + '` relation'); | ||
} | ||
var source = this.model; | ||
var foreign = this.target; | ||
return foreign.where(this.keyField, source.id).update(params); | ||
}; | ||
Relation.prototype.delete = function(params) { | ||
@@ -62,0 +73,0 @@ var knex = this.target.getKnex(); |
{ | ||
"name": "knex-model", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Small ORM", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14191
412