@mikro-orm/sql 7.0.17-dev.6 → 7.0.17-dev.8

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.
@@ -1676,18 +1676,19 @@ export class AbstractSqlDriver extends DatabaseDriver {
1676
1676
  });
1677
1677
  }
1678
1678
  const aliased = this.platform.quoteIdentifier(`${tableAlias}__${prop.fieldNames[0]}`);
1679
+ const sourceAlias = qb.helper.getTPTAliasForProperty(prop.name, tableAlias);
1679
1680
  if (prop.customTypes?.some(type => !!type?.convertToJSValueSQL)) {
1680
1681
  return prop.fieldNames.map((col, idx) => {
1681
1682
  if (!prop.customTypes[idx]?.convertToJSValueSQL) {
1682
1683
  return col;
1683
1684
  }
1684
- const prefixed = this.platform.quoteIdentifier(`${tableAlias}.${col}`);
1685
+ const prefixed = this.platform.quoteIdentifier(`${sourceAlias}.${col}`);
1685
1686
  const aliased = this.platform.quoteIdentifier(`${tableAlias}__${col}`);
1686
1687
  return raw(`${prop.customTypes[idx].convertToJSValueSQL(prefixed, this.platform)} as ${aliased}`);
1687
1688
  });
1688
1689
  }
1689
1690
  if (prop.customType?.convertToJSValueSQL) {
1690
- const prefixed = this.platform.quoteIdentifier(`${tableAlias}.${prop.fieldNames[0]}`);
1691
+ const prefixed = this.platform.quoteIdentifier(`${sourceAlias}.${prop.fieldNames[0]}`);
1691
1692
  return [raw(`${prop.customType.convertToJSValueSQL(prefixed, this.platform)} as ${aliased}`)];
1692
1693
  }
1693
1694
  if (prop.formula) {
@@ -1696,7 +1697,6 @@ export class AbstractSqlDriver extends DatabaseDriver {
1696
1697
  const columns = meta.createColumnMappingObject(tableAlias);
1697
1698
  return [raw(`${this.evaluateFormula(prop.formula, columns, table)} as ${aliased}`)];
1698
1699
  }
1699
- const sourceAlias = qb.helper.getTPTAliasForProperty(prop.name, tableAlias);
1700
1700
  return prop.fieldNames.map(fieldName => {
1701
1701
  return raw('?? as ??', [`${sourceAlias}.${fieldName}`, `${tableAlias}__${fieldName}`]);
1702
1702
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.0.17-dev.6",
3
+ "version": "7.0.17-dev.8",
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.0.16"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.0.17-dev.6"
56
+ "@mikro-orm/core": "7.0.17-dev.8"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"