@mikro-orm/knex
Advanced tools
Comparing version 6.3.14-dev.61 to 6.3.14-dev.62
{ | ||
"name": "@mikro-orm/knex", | ||
"version": "6.3.14-dev.61", | ||
"version": "6.3.14-dev.62", | ||
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.", | ||
@@ -69,3 +69,3 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"@mikro-orm/core": "6.3.14-dev.61", | ||
"@mikro-orm/core": "6.3.14-dev.62", | ||
"better-sqlite3": "*", | ||
@@ -72,0 +72,0 @@ "libsql": "*", |
@@ -317,3 +317,3 @@ "use strict"; | ||
if (this._onConflict) { | ||
this._onConflict[this._onConflict.length - 1].where = this._cond; | ||
this._onConflict[this._onConflict.length - 1].where = this.helper.processOnConflictCondition(this._cond, this._schema); | ||
this._cond = {}; | ||
@@ -320,0 +320,0 @@ } |
@@ -62,2 +62,3 @@ import type { Knex } from 'knex'; | ||
isTableNameAliasRequired(type?: QueryType): boolean; | ||
processOnConflictCondition(cond: QBFilterQuery, schema?: string): QBFilterQuery; | ||
} | ||
@@ -64,0 +65,0 @@ export interface Alias<T> { |
@@ -734,3 +734,13 @@ "use strict"; | ||
} | ||
// workaround for https://github.com/knex/knex/issues/5257 | ||
processOnConflictCondition(cond, schema) { | ||
const meta = this.metadata.get(this.entityName); | ||
const tableName = this.driver.getTableName(meta, { schema }, false); | ||
for (const key of Object.keys(cond)) { | ||
const mapped = this.mapper(key, enums_1.QueryType.INSERT); | ||
core_1.Utils.renameKey(cond, key, tableName + '.' + mapped); | ||
} | ||
return cond; | ||
} | ||
} | ||
exports.QueryBuilderHelper = QueryBuilderHelper; |
514289
10481