@mikro-orm/knex 6.1.10-dev.8 → 6.1.10-dev.9
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 +12 -9
- package/package.json +2 -2
package/AbstractSqlDriver.js
CHANGED
|
@@ -922,28 +922,31 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
|
|
|
922
922
|
* @internal
|
|
923
923
|
*/
|
|
924
924
|
mapPropToFieldNames(qb, prop, tableAlias) {
|
|
925
|
-
const
|
|
926
|
-
const aliased = knex.ref(tableAlias ? `${tableAlias}__${prop.fieldNames[0]}` : prop.fieldNames[0]).toString();
|
|
925
|
+
const aliased = this.platform.quoteIdentifier(tableAlias ? `${tableAlias}__${prop.fieldNames[0]}` : prop.fieldNames[0]);
|
|
927
926
|
if (tableAlias && prop.customTypes?.some(type => type?.convertToJSValueSQL)) {
|
|
928
927
|
return prop.fieldNames.map((col, idx) => {
|
|
929
928
|
if (!prop.customTypes[idx]?.convertToJSValueSQL) {
|
|
930
929
|
return col;
|
|
931
930
|
}
|
|
932
|
-
const prefixed =
|
|
933
|
-
const aliased =
|
|
931
|
+
const prefixed = this.platform.quoteIdentifier(`${tableAlias}.${col}`);
|
|
932
|
+
const aliased = this.platform.quoteIdentifier(`${tableAlias}__${col}`);
|
|
934
933
|
return (0, core_1.raw)(`${prop.customTypes[idx].convertToJSValueSQL(prefixed, this.platform)} as ${aliased}`);
|
|
935
934
|
});
|
|
936
935
|
}
|
|
937
936
|
if (tableAlias && prop.customType?.convertToJSValueSQL) {
|
|
938
|
-
const prefixed =
|
|
937
|
+
const prefixed = this.platform.quoteIdentifier(`${tableAlias}.${prop.fieldNames[0]}`);
|
|
939
938
|
return [(0, core_1.raw)(`${prop.customType.convertToJSValueSQL(prefixed, this.platform)} as ${aliased}`)];
|
|
940
939
|
}
|
|
941
940
|
if (prop.formula) {
|
|
942
|
-
const alias =
|
|
941
|
+
const alias = this.platform.quoteIdentifier(tableAlias ?? qb.alias);
|
|
943
942
|
return [(0, core_1.raw)(`${prop.formula(alias)} as ${aliased}`)];
|
|
944
943
|
}
|
|
945
944
|
if (tableAlias) {
|
|
946
|
-
return prop.fieldNames.map(fieldName =>
|
|
945
|
+
return prop.fieldNames.map(fieldName => {
|
|
946
|
+
const name = this.platform.quoteIdentifier(`${tableAlias}.${fieldName}`);
|
|
947
|
+
const alias = this.platform.quoteIdentifier(`${tableAlias}__${fieldName}`);
|
|
948
|
+
return (0, core_1.raw)(`${name} as ${alias}`);
|
|
949
|
+
});
|
|
947
950
|
}
|
|
948
951
|
return prop.fieldNames;
|
|
949
952
|
}
|
|
@@ -1207,8 +1210,8 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
|
|
|
1207
1210
|
meta.props
|
|
1208
1211
|
.filter(prop => prop.formula && !lazyProps.includes(prop))
|
|
1209
1212
|
.forEach(prop => {
|
|
1210
|
-
const a = this.
|
|
1211
|
-
const aliased = this.
|
|
1213
|
+
const a = this.platform.quoteIdentifier(alias);
|
|
1214
|
+
const aliased = this.platform.quoteIdentifier(prop.fieldNames[0]);
|
|
1212
1215
|
ret.push((0, core_1.raw)(`${prop.formula(a)} as ${aliased}`));
|
|
1213
1216
|
});
|
|
1214
1217
|
meta.props
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.1.10-dev.
|
|
3
|
+
"version": "6.1.10-dev.9",
|
|
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.
|
|
69
|
+
"@mikro-orm/core": "6.1.10-dev.9"
|
|
70
70
|
}
|
|
71
71
|
}
|