@mikro-orm/core 6.2.10-dev.51 → 6.2.10-dev.53

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.
@@ -109,7 +109,7 @@ class MetadataDiscovery {
109
109
  }
110
110
  }
111
111
  }
112
- filtered.forEach(meta => Object.values(meta.properties).forEach(prop => this.initIndexes(prop)));
112
+ filtered.forEach(meta => Object.values(meta.properties).forEach(prop => this.initIndexes(meta, prop)));
113
113
  filtered.forEach(meta => this.autoWireBidirectionalProperties(meta));
114
114
  filtered.forEach(meta => this.findReferencingProperties(meta, filtered));
115
115
  for (const meta of filtered) {
@@ -1204,8 +1204,9 @@ class MetadataDiscovery {
1204
1204
  }
1205
1205
  prop.unsigned ??= (prop.primary || prop.unsigned) && this.isNumericProperty(prop) && this.platform.supportsUnsigned();
1206
1206
  }
1207
- initIndexes(prop) {
1208
- if (prop.kind === enums_1.ReferenceKind.MANY_TO_ONE && this.platform.indexForeignKeys()) {
1207
+ initIndexes(meta, prop) {
1208
+ const hasIndex = meta.indexes.some(idx => idx.properties?.length === 1 && idx.properties[0] === prop.name);
1209
+ if (prop.kind === enums_1.ReferenceKind.MANY_TO_ONE && this.platform.indexForeignKeys() && !hasIndex) {
1209
1210
  prop.index ??= true;
1210
1211
  }
1211
1212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.2.10-dev.51",
3
+ "version": "6.2.10-dev.53",
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",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.2.0",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.2.10-dev.51",
67
+ "mikro-orm": "6.2.10-dev.53",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
package/types/Type.d.ts CHANGED
@@ -59,7 +59,7 @@ export declare abstract class Type<JSType = string, DBType = JSType> {
59
59
  * Gets the SQL declaration snippet for a field of this type.
60
60
  */
61
61
  getColumnType(prop: EntityProperty, platform: Platform): string;
62
- static getType<JSType, DBType = JSType>(cls: Constructor<Type<JSType, DBType>>): Type<JSType, DBType>;
62
+ static getType<JSType, DBType = JSType, TypeClass extends Constructor<Type<JSType, DBType>> = Constructor<Type<JSType, DBType>>>(cls: TypeClass): InstanceType<TypeClass>;
63
63
  /**
64
64
  * Checks whether the argument is instance of `Type`.
65
65
  */
package/typings.d.ts CHANGED
@@ -725,9 +725,9 @@ export interface LoadedReference<T> extends Reference<NonNullable<T>> {
725
725
  $: NonNullable<T>;
726
726
  get(): NonNullable<T>;
727
727
  }
728
- export interface LoadedScalarReference<T> extends ScalarReference<NonNullable<T>> {
729
- $: NonNullable<T>;
730
- get(): NonNullable<T>;
728
+ export interface LoadedScalarReference<T> extends ScalarReference<T> {
729
+ $: T;
730
+ get(): T;
731
731
  }
732
732
  export interface LoadedCollection<T extends object> extends Collection<T> {
733
733
  $: Collection<T>;