@mikro-orm/knex
Advanced tools
Comparing version 6.4.7-dev.17 to 6.4.7-dev.18
{ | ||
"name": "@mikro-orm/knex", | ||
"version": "6.4.7-dev.17", | ||
"version": "6.4.7-dev.18", | ||
"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.4.7-dev.17", | ||
"@mikro-orm/core": "6.4.7-dev.18", | ||
"better-sqlite3": "*", | ||
@@ -72,0 +72,0 @@ "libsql": "*", |
@@ -75,3 +75,3 @@ "use strict"; | ||
joinAlias = qb.getAliasForJoinPath(this.parent.getPath()); | ||
return core_1.Utils.getPrimaryKeyHash(this.prop.joinColumns.map(col => `${joinAlias ?? qb.alias}.${col}`)); | ||
return core_1.Utils.getPrimaryKeyHash(this.prop.ownColumns.map(col => `${joinAlias ?? qb.alias}.${col}`)); | ||
} | ||
@@ -82,6 +82,2 @@ const alias = joinAlias ?? qb.alias; | ||
} | ||
// if we found a matching join, we need to use the target table column names, as we use that alias instead of the root | ||
if (!joinAlias && this.prop.owner && this.prop.joinColumns.length > 1) { | ||
return core_1.Utils.getPrimaryKeyHash(this.prop.joinColumns.map(col => `${alias}.${col}`)); | ||
} | ||
return core_1.Utils.getPrimaryKeyHash(this.prop.referencedColumnNames.map(col => `${alias}.${col}`)); | ||
@@ -88,0 +84,0 @@ } |
@@ -46,5 +46,2 @@ "use strict"; | ||
if (fkIdx2 !== -1) { | ||
if (prop?.ownColumns && !prop.ownColumns.includes(f)) { | ||
continue; | ||
} | ||
parts.push(this.mapper(a !== this.alias ? `${a}.${prop.fieldNames[fkIdx2]}` : prop.fieldNames[fkIdx2], type, value, alias)); | ||
@@ -70,5 +67,2 @@ } | ||
} | ||
if (parts.length === 1) { | ||
return parts[0]; | ||
} | ||
return this.knex.raw('(' + parts.map(part => this.knex.ref(part)).join(', ') + ')'); | ||
@@ -75,0 +69,0 @@ } |
518971
10569