@mikro-orm/knex 6.2.6-dev.9 → 6.2.7-dev.0
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 +2 -1
- package/package.json +3 -3
- package/query/QueryBuilder.js +13 -1
- package/query/QueryBuilderHelper.js +2 -1
package/AbstractSqlDriver.js
CHANGED
|
@@ -248,7 +248,8 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
|
|
|
248
248
|
}
|
|
249
249
|
else if (prop.runtimeType === 'Date') {
|
|
250
250
|
const alias = `${relationAlias}__${prop.fieldNames[0]}`;
|
|
251
|
-
|
|
251
|
+
const type = typeof root[alias];
|
|
252
|
+
relationPojo[prop.name] = (['string', 'number'].includes(type) ? this.platform.parseDate(root[alias]) : root[alias]);
|
|
252
253
|
}
|
|
253
254
|
else {
|
|
254
255
|
const alias = `${relationAlias}__${prop.fieldNames[0]}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.7-dev.0",
|
|
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",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"sqlstring": "2.3.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^6.2.
|
|
66
|
+
"@mikro-orm/core": "^6.2.6"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.2.
|
|
69
|
+
"@mikro-orm/core": "6.2.7-dev.0"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/query/QueryBuilder.js
CHANGED
|
@@ -1278,7 +1278,19 @@ class QueryBuilder {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
1280
|
addPath(this._populate);
|
|
1281
|
-
|
|
1281
|
+
const joins = Object.entries(this._joins);
|
|
1282
|
+
const rootAlias = this.alias;
|
|
1283
|
+
function addParentAlias(alias) {
|
|
1284
|
+
const join = joins.find(j => j[1].alias === alias);
|
|
1285
|
+
if (join && join[1].ownerAlias !== rootAlias) {
|
|
1286
|
+
orderByAliases.push(join[1].ownerAlias);
|
|
1287
|
+
addParentAlias(join[1].ownerAlias);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
for (const orderByAlias of orderByAliases) {
|
|
1291
|
+
addParentAlias(orderByAlias);
|
|
1292
|
+
}
|
|
1293
|
+
for (const [key, join] of joins) {
|
|
1282
1294
|
const path = join.path?.replace(/\[populate]|\[pivot]|:ref/g, '').replace(new RegExp(`^${meta.className}.`), '');
|
|
1283
1295
|
if (!populate.has(path ?? '') && !orderByAliases.includes(join.alias)) {
|
|
1284
1296
|
delete this._joins[key];
|
|
@@ -542,7 +542,8 @@ class QueryBuilderHelper {
|
|
|
542
542
|
if (returningProps.length > 0) {
|
|
543
543
|
qb.returning(returningProps.flatMap(prop => {
|
|
544
544
|
if (prop.hasConvertToJSValueSQL) {
|
|
545
|
-
const
|
|
545
|
+
const aliased = this.platform.quoteIdentifier(prop.fieldNames[0]);
|
|
546
|
+
const sql = prop.customType.convertToJSValueSQL(aliased, this.platform) + ' as ' + this.platform.quoteIdentifier(prop.fieldNames[0]);
|
|
546
547
|
return [this.knex.raw(sql)];
|
|
547
548
|
}
|
|
548
549
|
return prop.fieldNames;
|