@mikro-orm/knex 5.8.5-dev.0 → 5.8.5-dev.2

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": "5.8.5-dev.0",
3
+ "version": "5.8.5-dev.2",
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,9 +66,9 @@
66
66
  "@mikro-orm/core": "^5.8.4"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "~5.8.5-dev.0",
70
- "@mikro-orm/entity-generator": "~5.8.5-dev.0",
71
- "@mikro-orm/migrations": "~5.8.5-dev.0",
69
+ "@mikro-orm/core": "~5.8.5-dev.2",
70
+ "@mikro-orm/entity-generator": "~5.8.5-dev.2",
71
+ "@mikro-orm/migrations": "~5.8.5-dev.2",
72
72
  "better-sqlite3": "*",
73
73
  "mssql": "*",
74
74
  "mysql": "*",
@@ -171,8 +171,13 @@ class QueryBuilderHelper {
171
171
  const conditions = [];
172
172
  const params = [];
173
173
  join.primaryKeys.forEach((primaryKey, idx) => {
174
- const left = `${join.ownerAlias}.${primaryKey}`;
175
174
  const right = `${join.alias}.${join.joinColumns[idx]}`;
175
+ if (join.prop.formula) {
176
+ const left = join.prop.formula(join.ownerAlias);
177
+ conditions.push(`${left} = ${this.knex.ref(right)}`);
178
+ return;
179
+ }
180
+ const left = join.prop.persist === false ? primaryKey : `${join.ownerAlias}.${primaryKey}`;
176
181
  conditions.push(`${this.knex.ref(left)} = ${this.knex.ref(right)}`);
177
182
  });
178
183
  Object.keys(join.cond).forEach(key => {