@mikro-orm/sql 7.1.0-dev.39 → 7.1.0-dev.40

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.
@@ -1960,18 +1960,19 @@ export class AbstractSqlDriver extends DatabaseDriver {
1960
1960
  });
1961
1961
  }
1962
1962
  const aliased = this.platform.quoteIdentifier(`${tableAlias}__${prop.fieldNames[0]}`);
1963
+ const sourceAlias = qb.helper.getTPTAliasForProperty(prop.name, tableAlias);
1963
1964
  if (prop.customTypes?.some(type => !!type?.convertToJSValueSQL)) {
1964
1965
  return prop.fieldNames.map((col, idx) => {
1965
1966
  if (!prop.customTypes[idx]?.convertToJSValueSQL) {
1966
1967
  return col;
1967
1968
  }
1968
- const prefixed = this.platform.quoteIdentifier(`${tableAlias}.${col}`);
1969
+ const prefixed = this.platform.quoteIdentifier(`${sourceAlias}.${col}`);
1969
1970
  const aliased = this.platform.quoteIdentifier(`${tableAlias}__${col}`);
1970
1971
  return raw(`${prop.customTypes[idx].convertToJSValueSQL(prefixed, this.platform)} as ${aliased}`);
1971
1972
  });
1972
1973
  }
1973
1974
  if (prop.customType?.convertToJSValueSQL) {
1974
- const prefixed = this.platform.quoteIdentifier(`${tableAlias}.${prop.fieldNames[0]}`);
1975
+ const prefixed = this.platform.quoteIdentifier(`${sourceAlias}.${prop.fieldNames[0]}`);
1975
1976
  return [raw(`${prop.customType.convertToJSValueSQL(prefixed, this.platform)} as ${aliased}`)];
1976
1977
  }
1977
1978
  if (prop.formula) {
@@ -1980,7 +1981,6 @@ export class AbstractSqlDriver extends DatabaseDriver {
1980
1981
  const columns = meta.createColumnMappingObject(tableAlias);
1981
1982
  return [raw(`${this.evaluateFormula(prop.formula, columns, table)} as ${aliased}`)];
1982
1983
  }
1983
- const sourceAlias = qb.helper.getTPTAliasForProperty(prop.name, tableAlias);
1984
1984
  return prop.fieldNames.map(fieldName => {
1985
1985
  return raw('?? as ??', [`${sourceAlias}.${fieldName}`, `${tableAlias}__${fieldName}`]);
1986
1986
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.1.0-dev.39",
3
+ "version": "7.1.0-dev.40",
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.1.0-dev.39"
56
+ "@mikro-orm/core": "7.1.0-dev.40"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"