@mikro-orm/knex 6.1.10-dev.11 → 6.1.10-dev.13

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.
@@ -826,7 +826,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
826
826
  if (!item[propName]) {
827
827
  continue;
828
828
  }
829
- if (prop.kind === core_1.ReferenceKind.MANY_TO_MANY && ref) {
829
+ if ([core_1.ReferenceKind.ONE_TO_MANY, core_1.ReferenceKind.MANY_TO_MANY].includes(prop.kind) && ref) {
830
830
  map[pk][propName] = [...map[pk][propName], ...item[propName]];
831
831
  continue;
832
832
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.1.10-dev.11",
3
+ "version": "6.1.10-dev.13",
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,6 +66,6 @@
66
66
  "@mikro-orm/core": "^6.1.9"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.1.10-dev.11"
69
+ "@mikro-orm/core": "6.1.10-dev.13"
70
70
  }
71
71
  }
@@ -86,7 +86,11 @@ class QueryBuilderHelper {
86
86
  const alias2 = this.knex.ref(a).toString();
87
87
  const aliased = this.knex.ref(prop.fieldNames[0]).toString();
88
88
  const as = alias === null ? '' : ` as ${aliased}`;
89
- return this.knex.raw(`${prop.formula(alias2)}${as}`);
89
+ let value = prop.formula(alias2);
90
+ if (!this.isTableNameAliasRequired(type)) {
91
+ value = value.replaceAll(alias2 + '.', '');
92
+ }
93
+ return this.knex.raw(`${value}${as}`);
90
94
  }
91
95
  if (prop?.hasConvertToJSValueSQL) {
92
96
  let valueSQL;