@mikro-orm/sql 7.1.5-dev.22 → 7.1.5-dev.23
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/AbstractSqlDriver.js +14 -0
- package/package.json +2 -2
package/AbstractSqlDriver.js
CHANGED
|
@@ -2214,6 +2214,20 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
2214
2214
|
const join = qb.getJoinForPath(path, { matchPopulateJoins: true });
|
|
2215
2215
|
const propAlias = qb.getAliasForJoinPath(join ?? path, { matchPopulateJoins: true }) ?? parentAlias;
|
|
2216
2216
|
if (!join) {
|
|
2217
|
+
// an owner to-one relation that is not joined (e.g. ordering a populated collection by such
|
|
2218
|
+
// a relation's primary key) can be ordered by its local FK columns, matching the `select-in`
|
|
2219
|
+
// and `balanced` strategies instead of silently dropping the clause
|
|
2220
|
+
if (prop.owner &&
|
|
2221
|
+
[ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop.kind) &&
|
|
2222
|
+
Utils.isPlainObject(childOrder)) {
|
|
2223
|
+
for (const childField of Utils.getObjectQueryKeys(childOrder)) {
|
|
2224
|
+
const idx = prop.referencedPKs.indexOf(childField);
|
|
2225
|
+
const order = childOrder[childField];
|
|
2226
|
+
if (idx !== -1 && order) {
|
|
2227
|
+
orderBy.push({ [`${parentAlias}.${prop.joinColumns[idx]}`]: order });
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2217
2231
|
continue;
|
|
2218
2232
|
}
|
|
2219
2233
|
if (join &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.1.5-dev.
|
|
3
|
+
"version": "7.1.5-dev.23",
|
|
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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@mikro-orm/core": "^7.1.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.1.5-dev.
|
|
56
|
+
"@mikro-orm/core": "7.1.5-dev.23"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|