@mikro-orm/knex 6.3.14-dev.60 → 6.3.14-dev.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.3.14-dev.60",
3
+ "version": "6.3.14-dev.62",
4
4
  "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.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -66,7 +66,7 @@
66
66
  "@mikro-orm/core": "^6.3.13"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.3.14-dev.60",
69
+ "@mikro-orm/core": "6.3.14-dev.62",
70
70
  "better-sqlite3": "*",
71
71
  "libsql": "*",
72
72
  "mariadb": "*"
@@ -314,7 +314,7 @@ class QueryBuilder {
314
314
  this._cond = { [op]: cond1 };
315
315
  }
316
316
  if (this._onConflict) {
317
- this._onConflict[this._onConflict.length - 1].where = this._cond;
317
+ this._onConflict[this._onConflict.length - 1].where = this.helper.processOnConflictCondition(this._cond, this._schema);
318
318
  this._cond = {};
319
319
  }
320
320
  return this;
@@ -59,6 +59,7 @@ export declare class QueryBuilderHelper {
59
59
  private fieldName;
60
60
  getProperty(field: string, alias?: string): EntityProperty | undefined;
61
61
  isTableNameAliasRequired(type?: QueryType): boolean;
62
+ processOnConflictCondition(cond: QBFilterQuery, schema?: string): QBFilterQuery;
62
63
  }
63
64
  export interface Alias<T> {
64
65
  aliasName: string;
@@ -731,5 +731,15 @@ class QueryBuilderHelper {
731
731
  isTableNameAliasRequired(type) {
732
732
  return [enums_1.QueryType.SELECT, enums_1.QueryType.COUNT].includes(type ?? enums_1.QueryType.SELECT);
733
733
  }
734
+ // workaround for https://github.com/knex/knex/issues/5257
735
+ processOnConflictCondition(cond, schema) {
736
+ const meta = this.metadata.get(this.entityName);
737
+ const tableName = this.driver.getTableName(meta, { schema }, false);
738
+ for (const key of Object.keys(cond)) {
739
+ const mapped = this.mapper(key, enums_1.QueryType.INSERT);
740
+ core_1.Utils.renameKey(cond, key, tableName + '.' + mapped);
741
+ }
742
+ return cond;
743
+ }
734
744
  }
735
745
  exports.QueryBuilderHelper = QueryBuilderHelper;