Skip to content

Commit

Permalink
test: fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Oct 7, 2019
1 parent 7567c3a commit cad26ca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Orm/Relations/BelongsTo/QueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ export class BelongsToQueryBuilder
* Constraint for one parent
*/
const value = this.$getRelatedValue(this._parent, this._relation.foreignKey)
return this.where(this._relation.localAdapterKey, value).limit(1)
this.where(this._relation.localAdapterKey, value)

if (!['update', 'delete'].includes(this.$queryAction())) {
this.limit(1)
}

return this
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/Orm/Relations/HasOne/QueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ export class HasOneQueryBuilder extends BaseRelationQueryBuilder implements HasO
* Constraint for one parent
*/
const value = this.$getRelatedValue(this._parent, this._relation.localKey)
return this.where(this._relation.foreignAdapterKey, value).limit(1)
this.where(this._relation.foreignAdapterKey, value)

if (!['update', 'delete'].includes(this.$queryAction())) {
this.limit(1)
}

return this
}

/**
Expand Down

0 comments on commit cad26ca

Please sign in to comment.