@mikro-orm/sql 7.2.5-dev.4 → 7.2.5-dev.6
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 +7 -7
- package/package.json +2 -2
package/AbstractSqlDriver.js
CHANGED
|
@@ -2087,6 +2087,12 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
2087
2087
|
}
|
|
2088
2088
|
const aliased = this.platform.quoteIdentifier(`${tableAlias}__${prop.fieldNames[0]}`);
|
|
2089
2089
|
const sourceAlias = qb.helper.getTPTAliasForProperty(prop.name, tableAlias);
|
|
2090
|
+
if (prop.formula) {
|
|
2091
|
+
const quotedAlias = this.platform.quoteIdentifier(tableAlias).toString();
|
|
2092
|
+
const table = this.createFormulaTable(quotedAlias, meta, schema);
|
|
2093
|
+
const columns = meta.createColumnMappingObject(tableAlias);
|
|
2094
|
+
return [raw(`${this.evaluateFormula(prop.formula, columns, table)} as ${aliased}`)];
|
|
2095
|
+
}
|
|
2090
2096
|
if (prop.customTypes?.some(type => !!type?.convertToJSValueSQL)) {
|
|
2091
2097
|
return prop.fieldNames.map((col, idx) => {
|
|
2092
2098
|
if (!prop.customTypes[idx]?.convertToJSValueSQL) {
|
|
@@ -2101,12 +2107,6 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
2101
2107
|
const prefixed = this.platform.quoteIdentifier(`${sourceAlias}.${prop.fieldNames[0]}`);
|
|
2102
2108
|
return [raw(`${prop.customType.convertToJSValueSQL(prefixed, this.platform)} as ${aliased}`)];
|
|
2103
2109
|
}
|
|
2104
|
-
if (prop.formula) {
|
|
2105
|
-
const quotedAlias = this.platform.quoteIdentifier(tableAlias).toString();
|
|
2106
|
-
const table = this.createFormulaTable(quotedAlias, meta, schema);
|
|
2107
|
-
const columns = meta.createColumnMappingObject(tableAlias);
|
|
2108
|
-
return [raw(`${this.evaluateFormula(prop.formula, columns, table)} as ${aliased}`)];
|
|
2109
|
-
}
|
|
2110
2110
|
return prop.fieldNames.map(fieldName => {
|
|
2111
2111
|
return raw('?? as ??', [`${sourceAlias}.${fieldName}`, `${tableAlias}__${fieldName}`]);
|
|
2112
2112
|
});
|
|
@@ -2527,7 +2527,7 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
2527
2527
|
const table = this.createFormulaTable(quotedAlias.toString(), meta, effectiveSchema);
|
|
2528
2528
|
ret.push(raw(`${this.evaluateFormula(prop.formula, columns, table)} as ${aliased}`));
|
|
2529
2529
|
}
|
|
2530
|
-
if (!prop.object && (prop.hasConvertToDatabaseValueSQL || prop.hasConvertToJSValueSQL)) {
|
|
2530
|
+
if (!prop.object && !prop.formula && (prop.hasConvertToDatabaseValueSQL || prop.hasConvertToJSValueSQL)) {
|
|
2531
2531
|
ret.push(prop.name);
|
|
2532
2532
|
}
|
|
2533
2533
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.2.5-dev.
|
|
3
|
+
"version": "7.2.5-dev.6",
|
|
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.2.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.2.5-dev.
|
|
56
|
+
"@mikro-orm/core": "7.2.5-dev.6"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|