@mikro-orm/core 7.2.9-dev.16 → 7.2.9-dev.17

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.
@@ -1499,11 +1499,15 @@ export class MetadataDiscovery {
1499
1499
  // that as matching so the rename branch below doesn't run (which would
1500
1500
  // crash — `targetMeta` is only populated later, in `initRelation`).
1501
1501
  const narrowedRelationOverride = rootProp != null && rootProp.type !== prop.type && this.sameRelationTargetRoot(rootProp, prop);
1502
+ // The root can hold another instance of the same custom type (e.g. the copy made for a polymorphic embeddable), so those are compared by class.
1503
+ const sameTypeClass = Type.isMappedType(rootProp?.type) &&
1504
+ Type.isMappedType(prop.type) &&
1505
+ rootProp.type.constructor === prop.type.constructor;
1502
1506
  // stiMerged is set during inlineProperties when a property was merged
1503
1507
  // from multiple polymorphic variants with different types. The flag is
1504
1508
  // cleared implicitly when the first child claims the root property via
1505
1509
  // addProperty below, so subsequent children correctly trigger renaming.
1506
- const typesMatch = rootProp?.type === prop.type || rootProp?.stiMerged === true || narrowedRelationOverride;
1510
+ const typesMatch = rootProp?.type === prop.type || sameTypeClass || rootProp?.stiMerged === true || narrowedRelationOverride;
1507
1511
  // Inverse-side relations (1:m, inverse m:n) have no FK column on this
1508
1512
  // entity, so the rename branch — which exists to disambiguate physical
1509
1513
  // columns shared across STI children — doesn't apply. Skipping it also
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.2.9-dev.16",
3
+ "version": "7.2.9-dev.17",
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",
package/utils/Utils.js CHANGED
@@ -153,7 +153,7 @@ export function parseJsonSafe(value) {
153
153
  /** Collection of general-purpose utility methods used throughout the ORM. */
154
154
  export class Utils {
155
155
  static PK_SEPARATOR = '~~~';
156
- static #ORM_VERSION = '7.2.9-dev.16';
156
+ static #ORM_VERSION = '7.2.9-dev.17';
157
157
  /** Default session variable name backing an RLS filter argument (`current_setting('mikro.<filter>.<arg>')`). */
158
158
  static getRlsSettingName(filterName, argName) {
159
159
  return `mikro.${filterName}.${argName}`;