Skip to content

Commit

Permalink
refactor: interpret qb.onConflict().merge([]) to `qb.onConflict().i…
Browse files Browse the repository at this point in the history
…gnore()`
  • Loading branch information
B4nan committed Nov 3, 2022
1 parent 1fb7a22 commit 18358a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/knex/src/query/QueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ export class QueryBuilder<T extends object = AnyEntity> {
throw new Error('You need to call `qb.onConflict()` first to use `qb.merge()`');
}

if (Array.isArray(data) && data.length === 0) {
return this.ignore();
}

this._onConflict[this._onConflict.length - 1].merge = data;
return this;
}
Expand Down

0 comments on commit 18358a6

Please sign in to comment.