@mikro-orm/core 7.0.4-dev.9 → 7.0.4

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.
Files changed (206) hide show
  1. package/EntityManager.d.ts +884 -583
  2. package/EntityManager.js +1922 -1895
  3. package/MikroORM.d.ts +103 -74
  4. package/MikroORM.js +178 -179
  5. package/README.md +1 -1
  6. package/cache/CacheAdapter.d.ts +36 -36
  7. package/cache/FileCacheAdapter.d.ts +30 -24
  8. package/cache/FileCacheAdapter.js +80 -78
  9. package/cache/GeneratedCacheAdapter.d.ts +18 -20
  10. package/cache/GeneratedCacheAdapter.js +30 -30
  11. package/cache/MemoryCacheAdapter.d.ts +18 -20
  12. package/cache/MemoryCacheAdapter.js +35 -36
  13. package/cache/NullCacheAdapter.d.ts +16 -16
  14. package/cache/NullCacheAdapter.js +24 -24
  15. package/connections/Connection.d.ts +95 -84
  16. package/connections/Connection.js +165 -168
  17. package/drivers/DatabaseDriver.d.ts +186 -80
  18. package/drivers/DatabaseDriver.js +450 -443
  19. package/drivers/IDatabaseDriver.d.ts +440 -301
  20. package/entity/BaseEntity.d.ts +120 -83
  21. package/entity/BaseEntity.js +43 -43
  22. package/entity/Collection.d.ts +212 -179
  23. package/entity/Collection.js +727 -721
  24. package/entity/EntityAssigner.d.ts +88 -77
  25. package/entity/EntityAssigner.js +231 -230
  26. package/entity/EntityFactory.d.ts +66 -54
  27. package/entity/EntityFactory.js +425 -383
  28. package/entity/EntityHelper.d.ts +34 -22
  29. package/entity/EntityHelper.js +280 -267
  30. package/entity/EntityIdentifier.d.ts +4 -4
  31. package/entity/EntityIdentifier.js +10 -10
  32. package/entity/EntityLoader.d.ts +98 -72
  33. package/entity/EntityLoader.js +753 -723
  34. package/entity/EntityRepository.d.ts +316 -201
  35. package/entity/EntityRepository.js +213 -213
  36. package/entity/PolymorphicRef.d.ts +5 -5
  37. package/entity/PolymorphicRef.js +10 -10
  38. package/entity/Reference.d.ts +126 -82
  39. package/entity/Reference.js +278 -274
  40. package/entity/WrappedEntity.d.ts +115 -72
  41. package/entity/WrappedEntity.js +168 -166
  42. package/entity/defineEntity.d.ts +1315 -636
  43. package/entity/defineEntity.js +527 -518
  44. package/entity/utils.d.ts +13 -3
  45. package/entity/utils.js +71 -73
  46. package/entity/validators.js +43 -43
  47. package/entity/wrap.js +8 -8
  48. package/enums.d.ts +258 -253
  49. package/enums.js +251 -252
  50. package/errors.d.ts +114 -72
  51. package/errors.js +350 -253
  52. package/events/EventManager.d.ts +26 -14
  53. package/events/EventManager.js +79 -77
  54. package/events/EventSubscriber.d.ts +29 -29
  55. package/events/TransactionEventBroadcaster.d.ts +15 -8
  56. package/events/TransactionEventBroadcaster.js +14 -14
  57. package/exceptions.d.ts +23 -40
  58. package/exceptions.js +35 -52
  59. package/hydration/Hydrator.d.ts +42 -17
  60. package/hydration/Hydrator.js +43 -43
  61. package/hydration/ObjectHydrator.d.ts +50 -17
  62. package/hydration/ObjectHydrator.js +481 -416
  63. package/index.d.ts +116 -2
  64. package/index.js +10 -1
  65. package/logging/DefaultLogger.d.ts +34 -32
  66. package/logging/DefaultLogger.js +86 -86
  67. package/logging/Logger.d.ts +41 -41
  68. package/logging/SimpleLogger.d.ts +13 -11
  69. package/logging/SimpleLogger.js +22 -22
  70. package/logging/colors.d.ts +6 -6
  71. package/logging/colors.js +11 -10
  72. package/logging/inspect.js +7 -7
  73. package/metadata/EntitySchema.d.ts +211 -127
  74. package/metadata/EntitySchema.js +397 -398
  75. package/metadata/MetadataDiscovery.d.ts +114 -114
  76. package/metadata/MetadataDiscovery.js +1951 -1863
  77. package/metadata/MetadataProvider.d.ts +24 -21
  78. package/metadata/MetadataProvider.js +82 -84
  79. package/metadata/MetadataStorage.d.ts +38 -32
  80. package/metadata/MetadataStorage.js +118 -118
  81. package/metadata/MetadataValidator.d.ts +39 -39
  82. package/metadata/MetadataValidator.js +381 -338
  83. package/metadata/discover-entities.d.ts +5 -2
  84. package/metadata/discover-entities.js +35 -27
  85. package/metadata/types.d.ts +615 -531
  86. package/naming-strategy/AbstractNamingStrategy.d.ts +54 -39
  87. package/naming-strategy/AbstractNamingStrategy.js +90 -85
  88. package/naming-strategy/EntityCaseNamingStrategy.d.ts +6 -6
  89. package/naming-strategy/EntityCaseNamingStrategy.js +22 -22
  90. package/naming-strategy/MongoNamingStrategy.d.ts +6 -6
  91. package/naming-strategy/MongoNamingStrategy.js +18 -18
  92. package/naming-strategy/NamingStrategy.d.ts +109 -99
  93. package/naming-strategy/UnderscoreNamingStrategy.d.ts +7 -7
  94. package/naming-strategy/UnderscoreNamingStrategy.js +21 -21
  95. package/not-supported.js +7 -4
  96. package/package.json +1 -1
  97. package/platforms/ExceptionConverter.d.ts +1 -1
  98. package/platforms/ExceptionConverter.js +4 -4
  99. package/platforms/Platform.d.ts +310 -299
  100. package/platforms/Platform.js +663 -636
  101. package/serialization/EntitySerializer.d.ts +49 -26
  102. package/serialization/EntitySerializer.js +224 -218
  103. package/serialization/EntityTransformer.d.ts +10 -6
  104. package/serialization/EntityTransformer.js +219 -217
  105. package/serialization/SerializationContext.d.ts +27 -23
  106. package/serialization/SerializationContext.js +105 -105
  107. package/types/ArrayType.d.ts +8 -8
  108. package/types/ArrayType.js +33 -33
  109. package/types/BigIntType.d.ts +17 -10
  110. package/types/BigIntType.js +37 -37
  111. package/types/BlobType.d.ts +3 -3
  112. package/types/BlobType.js +13 -13
  113. package/types/BooleanType.d.ts +4 -4
  114. package/types/BooleanType.js +12 -12
  115. package/types/CharacterType.d.ts +2 -2
  116. package/types/CharacterType.js +6 -6
  117. package/types/DateTimeType.d.ts +5 -5
  118. package/types/DateTimeType.js +15 -15
  119. package/types/DateType.d.ts +5 -5
  120. package/types/DateType.js +15 -15
  121. package/types/DecimalType.d.ts +7 -7
  122. package/types/DecimalType.js +26 -26
  123. package/types/DoubleType.d.ts +3 -3
  124. package/types/DoubleType.js +12 -12
  125. package/types/EnumArrayType.d.ts +5 -5
  126. package/types/EnumArrayType.js +24 -24
  127. package/types/EnumType.d.ts +3 -3
  128. package/types/EnumType.js +11 -11
  129. package/types/FloatType.d.ts +3 -3
  130. package/types/FloatType.js +9 -9
  131. package/types/IntegerType.d.ts +3 -3
  132. package/types/IntegerType.js +9 -9
  133. package/types/IntervalType.d.ts +4 -4
  134. package/types/IntervalType.js +12 -12
  135. package/types/JsonType.d.ts +8 -8
  136. package/types/JsonType.js +32 -32
  137. package/types/MediumIntType.d.ts +1 -1
  138. package/types/MediumIntType.js +3 -3
  139. package/types/SmallIntType.d.ts +3 -3
  140. package/types/SmallIntType.js +9 -9
  141. package/types/StringType.d.ts +4 -4
  142. package/types/StringType.js +12 -12
  143. package/types/TextType.d.ts +3 -3
  144. package/types/TextType.js +9 -9
  145. package/types/TimeType.d.ts +5 -5
  146. package/types/TimeType.js +17 -17
  147. package/types/TinyIntType.d.ts +3 -3
  148. package/types/TinyIntType.js +10 -10
  149. package/types/Type.d.ts +83 -79
  150. package/types/Type.js +82 -82
  151. package/types/Uint8ArrayType.d.ts +4 -4
  152. package/types/Uint8ArrayType.js +21 -21
  153. package/types/UnknownType.d.ts +4 -4
  154. package/types/UnknownType.js +12 -12
  155. package/types/UuidType.d.ts +5 -5
  156. package/types/UuidType.js +19 -19
  157. package/types/index.d.ts +75 -49
  158. package/types/index.js +52 -26
  159. package/typings.d.ts +1250 -737
  160. package/typings.js +244 -231
  161. package/unit-of-work/ChangeSet.d.ts +26 -26
  162. package/unit-of-work/ChangeSet.js +56 -56
  163. package/unit-of-work/ChangeSetComputer.d.ts +12 -12
  164. package/unit-of-work/ChangeSetComputer.js +178 -170
  165. package/unit-of-work/ChangeSetPersister.d.ts +63 -44
  166. package/unit-of-work/ChangeSetPersister.js +442 -421
  167. package/unit-of-work/CommitOrderCalculator.d.ts +40 -40
  168. package/unit-of-work/CommitOrderCalculator.js +89 -88
  169. package/unit-of-work/IdentityMap.d.ts +31 -31
  170. package/unit-of-work/IdentityMap.js +105 -105
  171. package/unit-of-work/UnitOfWork.d.ts +181 -141
  172. package/unit-of-work/UnitOfWork.js +1200 -1183
  173. package/utils/AbstractMigrator.d.ts +111 -91
  174. package/utils/AbstractMigrator.js +275 -275
  175. package/utils/AbstractSchemaGenerator.d.ts +43 -34
  176. package/utils/AbstractSchemaGenerator.js +121 -122
  177. package/utils/AsyncContext.d.ts +3 -3
  178. package/utils/AsyncContext.js +34 -35
  179. package/utils/Configuration.d.ts +852 -808
  180. package/utils/Configuration.js +359 -344
  181. package/utils/Cursor.d.ts +40 -22
  182. package/utils/Cursor.js +135 -127
  183. package/utils/DataloaderUtils.d.ts +58 -43
  184. package/utils/DataloaderUtils.js +203 -198
  185. package/utils/EntityComparator.d.ts +98 -81
  186. package/utils/EntityComparator.js +828 -728
  187. package/utils/NullHighlighter.d.ts +1 -1
  188. package/utils/NullHighlighter.js +3 -3
  189. package/utils/QueryHelper.d.ts +79 -51
  190. package/utils/QueryHelper.js +372 -361
  191. package/utils/RawQueryFragment.d.ts +50 -34
  192. package/utils/RawQueryFragment.js +107 -105
  193. package/utils/RequestContext.d.ts +32 -32
  194. package/utils/RequestContext.js +52 -53
  195. package/utils/TransactionContext.d.ts +16 -16
  196. package/utils/TransactionContext.js +27 -27
  197. package/utils/TransactionManager.d.ts +58 -58
  198. package/utils/TransactionManager.js +199 -197
  199. package/utils/Utils.d.ts +204 -145
  200. package/utils/Utils.js +812 -810
  201. package/utils/clone.js +104 -113
  202. package/utils/env-vars.js +90 -88
  203. package/utils/fs-utils.d.ts +15 -15
  204. package/utils/fs-utils.js +180 -181
  205. package/utils/upsert-utils.d.ts +20 -5
  206. package/utils/upsert-utils.js +114 -116
@@ -1,7 +1,27 @@
1
1
  import type { NamingStrategy } from '../naming-strategy/NamingStrategy.js';
2
2
  import { type CacheAdapter, type SyncCacheAdapter } from '../cache/CacheAdapter.js';
3
3
  import type { EntityRepository } from '../entity/EntityRepository.js';
4
- import type { AnyEntity, CompiledFunctions, Constructor, Dictionary, EnsureDatabaseOptions, EntityClass, EntityMetadata, FilterDef, GenerateOptions, Highlighter, HydratorConstructor, IHydrator, IMigrationGenerator, IPrimaryKey, MaybePromise, Migration, MigrationObject, Seeder, SeederObject } from '../typings.js';
4
+ import type {
5
+ AnyEntity,
6
+ CompiledFunctions,
7
+ Constructor,
8
+ Dictionary,
9
+ EnsureDatabaseOptions,
10
+ EntityClass,
11
+ EntityMetadata,
12
+ FilterDef,
13
+ GenerateOptions,
14
+ Highlighter,
15
+ HydratorConstructor,
16
+ IHydrator,
17
+ IMigrationGenerator,
18
+ IPrimaryKey,
19
+ MaybePromise,
20
+ Migration,
21
+ MigrationObject,
22
+ Seeder,
23
+ SeederObject,
24
+ } from '../typings.js';
5
25
  import { type Logger, type LoggerNamespace, type LoggerOptions } from '../logging/Logger.js';
6
26
  import type { EntityManager } from '../EntityManager.js';
7
27
  import type { Platform } from '../platforms/Platform.js';
@@ -16,895 +36,919 @@ import { EntityComparator } from './EntityComparator.js';
16
36
  import type { Type } from '../types/Type.js';
17
37
  import type { MikroORM } from '../MikroORM.js';
18
38
  /** Holds and validates all ORM configuration options, providing access to drivers, loggers, cache adapters, and other services. */
19
- export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>> {
20
- #private;
21
- constructor(options: Partial<Options>, validate?: boolean);
22
- /** Returns the database platform instance. */
23
- getPlatform(): ReturnType<D['getPlatform']>;
24
- /**
25
- * Gets specific configuration option. Falls back to specified `defaultValue` if provided.
26
- */
27
- get<T extends keyof Options<D, EM>, U extends Options<D, EM>[T]>(key: T, defaultValue?: U): U;
28
- /** Returns all configuration options. */
29
- getAll(): Options<D, EM>;
30
- /**
31
- * Overrides specified configuration value.
32
- */
33
- set<T extends keyof Options<D, EM>, U extends Options<D, EM>[T]>(key: T, value: U): void;
34
- /**
35
- * Resets the configuration to its default value
36
- */
37
- reset<T extends keyof Options<D, EM>>(key: T): void;
38
- /**
39
- * Gets Logger instance.
40
- */
41
- getLogger(): Logger;
42
- /**
43
- * Gets the logger instance for slow queries.
44
- * Falls back to the main logger if no custom slow query logger factory is configured.
45
- */
46
- getSlowQueryLogger(): Logger;
47
- /** Returns the configured dataloader type, normalizing boolean values. */
48
- getDataloaderType(): DataloaderType;
49
- /** Returns the configured schema name, optionally skipping the platform's default schema. */
50
- getSchema(skipDefaultSchema?: boolean): string | undefined;
51
- /**
52
- * Gets current database driver instance.
53
- */
54
- getDriver(): D;
55
- /** Registers a lazily-initialized extension by name. */
56
- registerExtension(name: string, cb: () => unknown): void;
57
- /** Returns a previously registered extension by name, initializing it on first access. */
58
- getExtension<T>(name: string): T | undefined;
59
- /**
60
- * Gets instance of NamingStrategy. (cached)
61
- */
62
- getNamingStrategy(): NamingStrategy;
63
- /**
64
- * Gets instance of Hydrator. (cached)
65
- */
66
- getHydrator(metadata: MetadataStorage): IHydrator;
67
- /**
68
- * Gets instance of Comparator. (cached)
69
- */
70
- getComparator(metadata: MetadataStorage): EntityComparator;
71
- /**
72
- * Gets instance of MetadataProvider. (cached)
73
- */
74
- getMetadataProvider(): MetadataProvider;
75
- /**
76
- * Gets instance of metadata CacheAdapter. (cached)
77
- */
78
- getMetadataCacheAdapter(): SyncCacheAdapter;
79
- /**
80
- * Gets instance of CacheAdapter for result cache. (cached)
81
- */
82
- getResultCacheAdapter(): CacheAdapter;
83
- /**
84
- * Gets EntityRepository class to be instantiated.
85
- */
86
- getRepositoryClass(repository: () => EntityClass<EntityRepository<AnyEntity>>): Options<D, EM>['entityRepository'];
87
- /**
88
- * Creates instance of given service and caches it.
89
- */
90
- getCachedService<T extends {
91
- new (...args: any[]): InstanceType<T>;
92
- }>(cls: T, ...args: ConstructorParameters<T>): InstanceType<T>;
93
- /** Clears the cached service instances, forcing re-creation on next access. */
94
- resetServiceCache(): void;
95
- private init;
96
- private sync;
97
- private validateOptions;
39
+ export declare class Configuration<
40
+ D extends IDatabaseDriver = IDatabaseDriver,
41
+ EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>,
42
+ > {
43
+ #private;
44
+ constructor(options: Partial<Options>, validate?: boolean);
45
+ /** Returns the database platform instance. */
46
+ getPlatform(): ReturnType<D['getPlatform']>;
47
+ /**
48
+ * Gets specific configuration option. Falls back to specified `defaultValue` if provided.
49
+ */
50
+ get<T extends keyof Options<D, EM>, U extends Options<D, EM>[T]>(key: T, defaultValue?: U): U;
51
+ /** Returns all configuration options. */
52
+ getAll(): Options<D, EM>;
53
+ /**
54
+ * Overrides specified configuration value.
55
+ */
56
+ set<T extends keyof Options<D, EM>, U extends Options<D, EM>[T]>(key: T, value: U): void;
57
+ /**
58
+ * Resets the configuration to its default value
59
+ */
60
+ reset<T extends keyof Options<D, EM>>(key: T): void;
61
+ /**
62
+ * Gets Logger instance.
63
+ */
64
+ getLogger(): Logger;
65
+ /**
66
+ * Gets the logger instance for slow queries.
67
+ * Falls back to the main logger if no custom slow query logger factory is configured.
68
+ */
69
+ getSlowQueryLogger(): Logger;
70
+ /** Returns the configured dataloader type, normalizing boolean values. */
71
+ getDataloaderType(): DataloaderType;
72
+ /** Returns the configured schema name, optionally skipping the platform's default schema. */
73
+ getSchema(skipDefaultSchema?: boolean): string | undefined;
74
+ /**
75
+ * Gets current database driver instance.
76
+ */
77
+ getDriver(): D;
78
+ /** Registers a lazily-initialized extension by name. */
79
+ registerExtension(name: string, cb: () => unknown): void;
80
+ /** Returns a previously registered extension by name, initializing it on first access. */
81
+ getExtension<T>(name: string): T | undefined;
82
+ /**
83
+ * Gets instance of NamingStrategy. (cached)
84
+ */
85
+ getNamingStrategy(): NamingStrategy;
86
+ /**
87
+ * Gets instance of Hydrator. (cached)
88
+ */
89
+ getHydrator(metadata: MetadataStorage): IHydrator;
90
+ /**
91
+ * Gets instance of Comparator. (cached)
92
+ */
93
+ getComparator(metadata: MetadataStorage): EntityComparator;
94
+ /**
95
+ * Gets instance of MetadataProvider. (cached)
96
+ */
97
+ getMetadataProvider(): MetadataProvider;
98
+ /**
99
+ * Gets instance of metadata CacheAdapter. (cached)
100
+ */
101
+ getMetadataCacheAdapter(): SyncCacheAdapter;
102
+ /**
103
+ * Gets instance of CacheAdapter for result cache. (cached)
104
+ */
105
+ getResultCacheAdapter(): CacheAdapter;
106
+ /**
107
+ * Gets EntityRepository class to be instantiated.
108
+ */
109
+ getRepositoryClass(repository: () => EntityClass<EntityRepository<AnyEntity>>): Options<D, EM>['entityRepository'];
110
+ /**
111
+ * Creates instance of given service and caches it.
112
+ */
113
+ getCachedService<
114
+ T extends {
115
+ new (...args: any[]): InstanceType<T>;
116
+ },
117
+ >(cls: T, ...args: ConstructorParameters<T>): InstanceType<T>;
118
+ /** Clears the cached service instances, forcing re-creation on next access. */
119
+ resetServiceCache(): void;
120
+ private init;
121
+ private sync;
122
+ private validateOptions;
98
123
  }
99
124
  /**
100
125
  * Type helper to make it easier to use `mikro-orm.config.js`.
101
126
  */
102
- export declare function defineConfig<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Partial<Options<D, EM, Entities>>;
127
+ export declare function defineConfig<
128
+ D extends IDatabaseDriver = IDatabaseDriver,
129
+ EM extends EntityManager<D> = EntityManager<D>,
130
+ Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
131
+ | string
132
+ | EntityClass<AnyEntity>
133
+ | EntitySchema
134
+ )[],
135
+ >(options: Partial<Options<D, EM, Entities>>): Partial<Options<D, EM, Entities>>;
103
136
  /**
104
137
  * Connection configuration options for database connections.
105
138
  * @see https://mikro-orm.io/docs/configuration#connection
106
139
  */
107
140
  export interface ConnectionOptions {
108
- /** Name of the database to connect to. */
109
- dbName?: string;
110
- /** Default database schema to use. */
111
- schema?: string;
112
- /** Name of the connection (used for logging when replicas are used). */
113
- name?: string;
114
- /** Full client connection URL. Overrides individual connection options. */
115
- clientUrl?: string;
116
- /** Database server hostname. */
117
- host?: string;
118
- /** Database server port number. */
119
- port?: number;
120
- /** Database user name. */
121
- user?: string;
122
- /**
123
- * Database password. Can be a string or a callback function that returns the password.
124
- * The callback is useful for short-lived tokens from cloud providers.
125
- * @example
126
- * password: async () => someCallToGetTheToken()
127
- */
128
- password?: string | (() => MaybePromise<string>);
129
- /** Character set for the connection. */
130
- charset?: string;
131
- /** Collation for the connection. */
132
- collate?: string;
133
- /**
134
- * Enable multiple statements in a single query.
135
- * Required for importing database dump files.
136
- * Should be disabled in production for security.
137
- * @default false
138
- */
139
- multipleStatements?: boolean;
140
- /** Connection pool configuration. */
141
- pool?: PoolConfig;
142
- /**
143
- * Additional driver-specific options.
144
- * The object will be deeply merged with internal driver options.
145
- */
146
- driverOptions?: Dictionary;
147
- /** Callback to execute when a new connection is created. */
148
- onCreateConnection?: (connection: unknown) => Promise<void>;
149
- /**
150
- * SQLite/libSQL: databases to attach on connection.
151
- * Each attached database acts as a schema, accessible via `schema.table` syntax.
152
- * Entities can reference attached databases via `@Entity({ schema: 'db_name' })`.
153
- * Note: Not supported for remote libSQL connections.
154
- * @example
155
- * attachDatabases: [
156
- * { name: 'users_db', path: './users.db' },
157
- * { name: 'logs_db', path: '/var/data/logs.db' },
158
- * ]
159
- */
160
- attachDatabases?: {
161
- name: string;
162
- path: string;
163
- }[];
141
+ /** Name of the database to connect to. */
142
+ dbName?: string;
143
+ /** Default database schema to use. */
144
+ schema?: string;
145
+ /** Name of the connection (used for logging when replicas are used). */
146
+ name?: string;
147
+ /** Full client connection URL. Overrides individual connection options. */
148
+ clientUrl?: string;
149
+ /** Database server hostname. */
150
+ host?: string;
151
+ /** Database server port number. */
152
+ port?: number;
153
+ /** Database user name. */
154
+ user?: string;
155
+ /**
156
+ * Database password. Can be a string or a callback function that returns the password.
157
+ * The callback is useful for short-lived tokens from cloud providers.
158
+ * @example
159
+ * password: async () => someCallToGetTheToken()
160
+ */
161
+ password?: string | (() => MaybePromise<string>);
162
+ /** Character set for the connection. */
163
+ charset?: string;
164
+ /** Collation for the connection. */
165
+ collate?: string;
166
+ /**
167
+ * Enable multiple statements in a single query.
168
+ * Required for importing database dump files.
169
+ * Should be disabled in production for security.
170
+ * @default false
171
+ */
172
+ multipleStatements?: boolean;
173
+ /** Connection pool configuration. */
174
+ pool?: PoolConfig;
175
+ /**
176
+ * Additional driver-specific options.
177
+ * The object will be deeply merged with internal driver options.
178
+ */
179
+ driverOptions?: Dictionary;
180
+ /** Callback to execute when a new connection is created. */
181
+ onCreateConnection?: (connection: unknown) => Promise<void>;
182
+ /**
183
+ * SQLite/libSQL: databases to attach on connection.
184
+ * Each attached database acts as a schema, accessible via `schema.table` syntax.
185
+ * Entities can reference attached databases via `@Entity({ schema: 'db_name' })`.
186
+ * Note: Not supported for remote libSQL connections.
187
+ * @example
188
+ * attachDatabases: [
189
+ * { name: 'users_db', path: './users.db' },
190
+ * { name: 'logs_db', path: '/var/data/logs.db' },
191
+ * ]
192
+ */
193
+ attachDatabases?: {
194
+ name: string;
195
+ path: string;
196
+ }[];
164
197
  }
165
198
  /**
166
199
  * Configuration options for database migrations.
167
200
  * @see https://mikro-orm.io/docs/migrations
168
201
  */
169
202
  export type MigrationsOptions = {
170
- /**
171
- * Name of the migrations table.
172
- * @default 'mikro_orm_migrations'
173
- */
174
- tableName?: string;
175
- /**
176
- * Path to the folder with migration files (for compiled JavaScript files).
177
- * @default './migrations'
178
- */
179
- path?: string;
180
- /**
181
- * Path to the folder with migration files (for TypeScript source files).
182
- * Used when running in TypeScript mode.
183
- */
184
- pathTs?: string;
185
- /**
186
- * Glob pattern to match migration files.
187
- * @default '!(*.d).{js,ts,cjs}'
188
- */
189
- glob?: string;
190
- /**
191
- * Disable logging for migration operations.
192
- * @default false
193
- */
194
- silent?: boolean;
195
- /**
196
- * Run each migration inside a transaction.
197
- * @default true
198
- */
199
- transactional?: boolean;
200
- /**
201
- * Try to disable foreign key checks during migrations.
202
- * @default false
203
- */
204
- disableForeignKeys?: boolean;
205
- /**
206
- * Run all migrations in the current batch in a master transaction.
207
- * @default true
208
- */
209
- allOrNothing?: boolean;
210
- /**
211
- * Allow dropping tables during schema diff.
212
- * @default true
213
- */
214
- dropTables?: boolean;
215
- /**
216
- * Safe mode - only allow adding new tables and columns, never dropping existing ones.
217
- * @default false
218
- */
219
- safe?: boolean;
220
- /**
221
- * Create a snapshot of the current schema after migration generation.
222
- * @default true
223
- */
224
- snapshot?: boolean;
225
- /** Custom name for the snapshot file. */
226
- snapshotName?: string;
227
- /**
228
- * File extension for generated migration files.
229
- * @default 'ts'
230
- */
231
- emit?: 'js' | 'ts' | 'cjs';
232
- /** Custom migration generator class. */
233
- generator?: Constructor<IMigrationGenerator>;
234
- /**
235
- * Custom function to generate migration file names.
236
- * @default (timestamp, name) => `Migration${timestamp}${name ? '_' + name : ''}`
237
- */
238
- fileName?: (timestamp: string, name?: string) => string;
239
- /** List of migration classes or objects to use instead of file-based discovery. */
240
- migrationsList?: (MigrationObject | Constructor<Migration>)[];
203
+ /**
204
+ * Name of the migrations table.
205
+ * @default 'mikro_orm_migrations'
206
+ */
207
+ tableName?: string;
208
+ /**
209
+ * Path to the folder with migration files (for compiled JavaScript files).
210
+ * @default './migrations'
211
+ */
212
+ path?: string;
213
+ /**
214
+ * Path to the folder with migration files (for TypeScript source files).
215
+ * Used when running in TypeScript mode.
216
+ */
217
+ pathTs?: string;
218
+ /**
219
+ * Glob pattern to match migration files.
220
+ * @default '!(*.d).{js,ts,cjs}'
221
+ */
222
+ glob?: string;
223
+ /**
224
+ * Disable logging for migration operations.
225
+ * @default false
226
+ */
227
+ silent?: boolean;
228
+ /**
229
+ * Run each migration inside a transaction.
230
+ * @default true
231
+ */
232
+ transactional?: boolean;
233
+ /**
234
+ * Try to disable foreign key checks during migrations.
235
+ * @default false
236
+ */
237
+ disableForeignKeys?: boolean;
238
+ /**
239
+ * Run all migrations in the current batch in a master transaction.
240
+ * @default true
241
+ */
242
+ allOrNothing?: boolean;
243
+ /**
244
+ * Allow dropping tables during schema diff.
245
+ * @default true
246
+ */
247
+ dropTables?: boolean;
248
+ /**
249
+ * Safe mode - only allow adding new tables and columns, never dropping existing ones.
250
+ * @default false
251
+ */
252
+ safe?: boolean;
253
+ /**
254
+ * Create a snapshot of the current schema after migration generation.
255
+ * @default true
256
+ */
257
+ snapshot?: boolean;
258
+ /** Custom name for the snapshot file. */
259
+ snapshotName?: string;
260
+ /**
261
+ * File extension for generated migration files.
262
+ * @default 'ts'
263
+ */
264
+ emit?: 'js' | 'ts' | 'cjs';
265
+ /** Custom migration generator class. */
266
+ generator?: Constructor<IMigrationGenerator>;
267
+ /**
268
+ * Custom function to generate migration file names.
269
+ * @default (timestamp, name) => `Migration${timestamp}${name ? '_' + name : ''}`
270
+ */
271
+ fileName?: (timestamp: string, name?: string) => string;
272
+ /** List of migration classes or objects to use instead of file-based discovery. */
273
+ migrationsList?: (MigrationObject | Constructor<Migration>)[];
241
274
  };
242
275
  /**
243
276
  * Configuration options for database seeders.
244
277
  * @see https://mikro-orm.io/docs/seeding
245
278
  */
246
279
  export interface SeederOptions {
247
- /**
248
- * Path to the folder with seeder files (for compiled JavaScript files).
249
- * @default './seeders'
250
- */
251
- path?: string;
252
- /**
253
- * Path to the folder with seeder files (for TypeScript source files).
254
- * Used when running in TypeScript mode.
255
- */
256
- pathTs?: string;
257
- /**
258
- * Glob pattern to match seeder files.
259
- * @default '!(*.d).{js,ts}'
260
- */
261
- glob?: string;
262
- /**
263
- * Name of the default seeder class to run.
264
- * @default 'DatabaseSeeder'
265
- */
266
- defaultSeeder?: string;
267
- /**
268
- * File extension for generated seeder files.
269
- * @default 'ts'
270
- */
271
- emit?: 'js' | 'ts';
272
- /**
273
- * Custom function to generate seeder file names.
274
- * @default (className) => className
275
- */
276
- fileName?: (className: string) => string;
277
- /** List of seeder classes or objects to use instead of file-based discovery. */
278
- seedersList?: (SeederObject | Constructor<Seeder>)[];
280
+ /**
281
+ * Path to the folder with seeder files (for compiled JavaScript files).
282
+ * @default './seeders'
283
+ */
284
+ path?: string;
285
+ /**
286
+ * Path to the folder with seeder files (for TypeScript source files).
287
+ * Used when running in TypeScript mode.
288
+ */
289
+ pathTs?: string;
290
+ /**
291
+ * Glob pattern to match seeder files.
292
+ * @default '!(*.d).{js,ts}'
293
+ */
294
+ glob?: string;
295
+ /**
296
+ * Name of the default seeder class to run.
297
+ * @default 'DatabaseSeeder'
298
+ */
299
+ defaultSeeder?: string;
300
+ /**
301
+ * File extension for generated seeder files.
302
+ * @default 'ts'
303
+ */
304
+ emit?: 'js' | 'ts';
305
+ /**
306
+ * Custom function to generate seeder file names.
307
+ * @default (className) => className
308
+ */
309
+ fileName?: (className: string) => string;
310
+ /** List of seeder classes or objects to use instead of file-based discovery. */
311
+ seedersList?: (SeederObject | Constructor<Seeder>)[];
279
312
  }
280
313
  /**
281
314
  * Connection pool configuration.
282
315
  * @see https://mikro-orm.io/docs/configuration#connection
283
316
  */
284
317
  export interface PoolConfig {
285
- /** Minimum number of connections to keep in the pool. */
286
- min?: number;
287
- /** Maximum number of connections allowed in the pool. */
288
- max?: number;
289
- /** Time in milliseconds before an idle connection is closed. */
290
- idleTimeoutMillis?: number;
318
+ /** Minimum number of connections to keep in the pool. */
319
+ min?: number;
320
+ /** Maximum number of connections allowed in the pool. */
321
+ max?: number;
322
+ /** Time in milliseconds before an idle connection is closed. */
323
+ idleTimeoutMillis?: number;
291
324
  }
292
325
  /**
293
326
  * Configuration options for metadata discovery.
294
327
  * @see https://mikro-orm.io/docs/configuration#entity-discovery
295
328
  */
296
329
  export interface MetadataDiscoveryOptions {
297
- /**
298
- * Throw an error when no entities are discovered.
299
- * @default true
300
- */
301
- warnWhenNoEntities?: boolean;
302
- /**
303
- * Check for duplicate table names and throw an error if found.
304
- * @default true
305
- */
306
- checkDuplicateTableNames?: boolean;
307
- /**
308
- * Check for duplicate field names and throw an error if found.
309
- * @default true
310
- */
311
- checkDuplicateFieldNames?: boolean;
312
- /**
313
- * Check for composite primary keys marked as `persist: false` and throw an error if found.
314
- * @default true
315
- */
316
- checkNonPersistentCompositeProps?: boolean;
317
- /**
318
- * Infer default values from property initializers when possible
319
- * (if the constructor can be invoked without parameters).
320
- * @default true
321
- */
322
- inferDefaultValues?: boolean;
323
- /**
324
- * Custom callback to override default type mapping.
325
- * Allows customizing how property types are mapped to database column types.
326
- * @example
327
- * getMappedType(type, platform) {
328
- * if (type === 'string') {
329
- * return Type.getType(TextType);
330
- * }
331
- * return platform.getDefaultMappedType(type);
332
- * }
333
- */
334
- getMappedType?: (type: string, platform: Platform) => Type<unknown> | undefined;
335
- /**
336
- * Hook called for each entity metadata during discovery.
337
- * Can be used to modify metadata dynamically before defaults are filled in.
338
- * The hook can be async when using `MikroORM.init()`.
339
- */
340
- onMetadata?: (meta: EntityMetadata, platform: Platform) => MaybePromise<void>;
341
- /**
342
- * Hook called after all entities are discovered.
343
- * Can be used to access and modify all metadata at once.
344
- */
345
- afterDiscovered?: (storage: MetadataStorage, platform: Platform) => MaybePromise<void>;
346
- /** Path to the TypeScript configuration file for ts-morph metadata provider. */
347
- tsConfigPath?: string;
348
- /** @internal */
349
- skipSyncDiscovery?: boolean;
330
+ /**
331
+ * Throw an error when no entities are discovered.
332
+ * @default true
333
+ */
334
+ warnWhenNoEntities?: boolean;
335
+ /**
336
+ * Check for duplicate table names and throw an error if found.
337
+ * @default true
338
+ */
339
+ checkDuplicateTableNames?: boolean;
340
+ /**
341
+ * Check for duplicate field names and throw an error if found.
342
+ * @default true
343
+ */
344
+ checkDuplicateFieldNames?: boolean;
345
+ /**
346
+ * Check for composite primary keys marked as `persist: false` and throw an error if found.
347
+ * @default true
348
+ */
349
+ checkNonPersistentCompositeProps?: boolean;
350
+ /**
351
+ * Infer default values from property initializers when possible
352
+ * (if the constructor can be invoked without parameters).
353
+ * @default true
354
+ */
355
+ inferDefaultValues?: boolean;
356
+ /**
357
+ * Custom callback to override default type mapping.
358
+ * Allows customizing how property types are mapped to database column types.
359
+ * @example
360
+ * getMappedType(type, platform) {
361
+ * if (type === 'string') {
362
+ * return Type.getType(TextType);
363
+ * }
364
+ * return platform.getDefaultMappedType(type);
365
+ * }
366
+ */
367
+ getMappedType?: (type: string, platform: Platform) => Type<unknown> | undefined;
368
+ /**
369
+ * Hook called for each entity metadata during discovery.
370
+ * Can be used to modify metadata dynamically before defaults are filled in.
371
+ * The hook can be async when using `MikroORM.init()`.
372
+ */
373
+ onMetadata?: (meta: EntityMetadata, platform: Platform) => MaybePromise<void>;
374
+ /**
375
+ * Hook called after all entities are discovered.
376
+ * Can be used to access and modify all metadata at once.
377
+ */
378
+ afterDiscovered?: (storage: MetadataStorage, platform: Platform) => MaybePromise<void>;
379
+ /** Path to the TypeScript configuration file for ts-morph metadata provider. */
380
+ tsConfigPath?: string;
381
+ /** @internal */
382
+ skipSyncDiscovery?: boolean;
350
383
  }
351
384
  /**
352
385
  * MikroORM configuration options.
353
386
  * @see https://mikro-orm.io/docs/configuration
354
387
  */
355
- export interface Options<Driver extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<Driver> & Driver[typeof EntityManagerType] = EntityManager<Driver> & Driver[typeof EntityManagerType], Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends ConnectionOptions {
356
- /** Connection pool configuration. */
357
- pool: PoolConfig;
358
- /**
359
- * Additional driver-specific options.
360
- * The object will be deeply merged with internal driver options.
361
- */
362
- driverOptions: Dictionary;
363
- /**
364
- * Array of entity classes or paths to entity modules.
365
- * Paths support glob patterns for automatic discovery.
366
- * @example
367
- * entities: [Author, Book, Publisher] // class references
368
- * entities: ['./dist/entities'] // folder paths
369
- */
370
- entities: Entities;
371
- /**
372
- * Array of TypeScript entity source paths.
373
- * Used when running in TypeScript mode (e.g., via `tsx` or `swc`).
374
- * Should always be specified when using folder-based discovery.
375
- * @example
376
- * entitiesTs: ['./src/entities']
377
- */
378
- entitiesTs: Entities;
379
- /**
380
- * ORM extensions to register (e.g., Migrator, EntityGenerator, SeedManager).
381
- * Extensions registered here are available via shortcuts like `orm.migrator`.
382
- * @example
383
- * extensions: [Migrator, EntityGenerator, SeedManager]
384
- */
385
- extensions: {
386
- register: (orm: MikroORM) => void;
387
- }[];
388
- /**
389
- * Event subscribers to register.
390
- * Can be class references or instances.
391
- */
392
- subscribers: Iterable<EventSubscriber | Constructor<EventSubscriber>>;
393
- /**
394
- * Global entity filters to apply.
395
- * Filters are applied by default unless explicitly disabled.
396
- * @see https://mikro-orm.io/docs/filters
397
- */
398
- filters: Dictionary<{
399
- name?: string;
400
- } & Omit<FilterDef, 'name'>>;
401
- /**
402
- * Metadata discovery configuration options.
403
- * Controls how entities are discovered and validated.
404
- */
405
- discovery: MetadataDiscoveryOptions;
406
- /**
407
- * Database driver class to use.
408
- * Should be imported from the specific driver package (e.g. `@mikro-orm/mysql`, `@mikro-orm/postgresql`).
409
- * Alternatively, use the `defineConfig` helper or `MikroORM` class exported from the driver package.
410
- * @example
411
- * import { MySqlDriver } from '@mikro-orm/mysql';
412
- *
413
- * MikroORM.init({
414
- * driver: MySqlDriver,
415
- * dbName: 'my_db',
416
- * });
417
- */
418
- driver?: {
419
- new (config: Configuration): Driver;
420
- };
421
- /**
422
- * Custom naming strategy class for mapping entity/property names to database table/column names.
423
- * Built-in options: `UnderscoreNamingStrategy`, `MongoNamingStrategy`, `EntityCaseNamingStrategy`.
424
- * @see https://mikro-orm.io/docs/naming-strategy
425
- */
426
- namingStrategy?: {
427
- new (): NamingStrategy;
428
- };
429
- /**
430
- * Enable implicit transactions for all write operations.
431
- * When enabled, all queries will be wrapped in a transaction.
432
- * Disabled for MongoDB driver by default.
433
- */
434
- implicitTransactions?: boolean;
435
- /**
436
- * Disable all transactions.
437
- * When enabled, no queries will be wrapped in transactions, even when explicitly requested.
438
- * @default false
439
- */
440
- disableTransactions?: boolean;
441
- /**
442
- * Enable verbose logging of internal operations.
443
- * @default false
444
- */
445
- verbose: boolean;
446
- /**
447
- * Ignore `undefined` values in find queries instead of treating them as `null`.
448
- * @default false
449
- * @example
450
- * // With ignoreUndefinedInQuery: true
451
- * em.find(User, { email: undefined }) // resolves to em.find(User, {})
452
- */
453
- ignoreUndefinedInQuery: boolean;
454
- /**
455
- * Hook to modify SQL queries before execution.
456
- * Useful for adding observability hints or query modifications.
457
- * @param sql - The generated SQL query
458
- * @param params - Query parameters
459
- * @returns Modified SQL query
460
- */
461
- onQuery: (sql: string, params: readonly unknown[]) => string;
462
- /**
463
- * Automatically join the owning side of 1:1 relations when querying the inverse side.
464
- * @default true
465
- */
466
- autoJoinOneToOneOwner: boolean;
467
- /**
468
- * Automatically join M:1 and 1:1 relations when filters are defined on them.
469
- * Important for implementing soft deletes via filters.
470
- * @default true
471
- */
472
- autoJoinRefsForFilters: boolean;
473
- /**
474
- * Apply filters to relations in queries.
475
- * @default true
476
- */
477
- filtersOnRelations: boolean;
478
- /**
479
- * Enable propagation of changes on entity prototypes.
388
+ export interface Options<
389
+ Driver extends IDatabaseDriver = IDatabaseDriver,
390
+ EM extends EntityManager<Driver> & Driver[typeof EntityManagerType] = EntityManager<Driver> &
391
+ Driver[typeof EntityManagerType],
392
+ Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
393
+ | string
394
+ | EntityClass<AnyEntity>
395
+ | EntitySchema
396
+ )[],
397
+ > extends ConnectionOptions {
398
+ /** Connection pool configuration. */
399
+ pool: PoolConfig;
400
+ /**
401
+ * Additional driver-specific options.
402
+ * The object will be deeply merged with internal driver options.
403
+ */
404
+ driverOptions: Dictionary;
405
+ /**
406
+ * Array of entity classes or paths to entity modules.
407
+ * Paths support glob patterns for automatic discovery.
408
+ * @example
409
+ * entities: [Author, Book, Publisher] // class references
410
+ * entities: ['./dist/entities'] // folder paths
411
+ */
412
+ entities: Entities;
413
+ /**
414
+ * Array of TypeScript entity source paths.
415
+ * Used when running in TypeScript mode (e.g., via `tsx` or `swc`).
416
+ * Should always be specified when using folder-based discovery.
417
+ * @example
418
+ * entitiesTs: ['./src/entities']
419
+ */
420
+ entitiesTs: Entities;
421
+ /**
422
+ * ORM extensions to register (e.g., Migrator, EntityGenerator, SeedManager).
423
+ * Extensions registered here are available via shortcuts like `orm.migrator`.
424
+ * @example
425
+ * extensions: [Migrator, EntityGenerator, SeedManager]
426
+ */
427
+ extensions: {
428
+ register: (orm: MikroORM) => void;
429
+ }[];
430
+ /**
431
+ * Event subscribers to register.
432
+ * Can be class references or instances.
433
+ */
434
+ subscribers: Iterable<EventSubscriber | Constructor<EventSubscriber>>;
435
+ /**
436
+ * Global entity filters to apply.
437
+ * Filters are applied by default unless explicitly disabled.
438
+ * @see https://mikro-orm.io/docs/filters
439
+ */
440
+ filters: Dictionary<
441
+ {
442
+ name?: string;
443
+ } & Omit<FilterDef, 'name'>
444
+ >;
445
+ /**
446
+ * Metadata discovery configuration options.
447
+ * Controls how entities are discovered and validated.
448
+ */
449
+ discovery: MetadataDiscoveryOptions;
450
+ /**
451
+ * Database driver class to use.
452
+ * Should be imported from the specific driver package (e.g. `@mikro-orm/mysql`, `@mikro-orm/postgresql`).
453
+ * Alternatively, use the `defineConfig` helper or `MikroORM` class exported from the driver package.
454
+ * @example
455
+ * import { MySqlDriver } from '@mikro-orm/mysql';
456
+ *
457
+ * MikroORM.init({
458
+ * driver: MySqlDriver,
459
+ * dbName: 'my_db',
460
+ * });
461
+ */
462
+ driver?: {
463
+ new (config: Configuration): Driver;
464
+ };
465
+ /**
466
+ * Custom naming strategy class for mapping entity/property names to database table/column names.
467
+ * Built-in options: `UnderscoreNamingStrategy`, `MongoNamingStrategy`, `EntityCaseNamingStrategy`.
468
+ * @see https://mikro-orm.io/docs/naming-strategy
469
+ */
470
+ namingStrategy?: {
471
+ new (): NamingStrategy;
472
+ };
473
+ /**
474
+ * Enable implicit transactions for all write operations.
475
+ * When enabled, all queries will be wrapped in a transaction.
476
+ * Disabled for MongoDB driver by default.
477
+ */
478
+ implicitTransactions?: boolean;
479
+ /**
480
+ * Disable all transactions.
481
+ * When enabled, no queries will be wrapped in transactions, even when explicitly requested.
482
+ * @default false
483
+ */
484
+ disableTransactions?: boolean;
485
+ /**
486
+ * Enable verbose logging of internal operations.
487
+ * @default false
488
+ */
489
+ verbose: boolean;
490
+ /**
491
+ * Ignore `undefined` values in find queries instead of treating them as `null`.
492
+ * @default false
493
+ * @example
494
+ * // With ignoreUndefinedInQuery: true
495
+ * em.find(User, { email: undefined }) // resolves to em.find(User, {})
496
+ */
497
+ ignoreUndefinedInQuery: boolean;
498
+ /**
499
+ * Hook to modify SQL queries before execution.
500
+ * Useful for adding observability hints or query modifications.
501
+ * @param sql - The generated SQL query
502
+ * @param params - Query parameters
503
+ * @returns Modified SQL query
504
+ */
505
+ onQuery: (sql: string, params: readonly unknown[]) => string;
506
+ /**
507
+ * Automatically join the owning side of 1:1 relations when querying the inverse side.
508
+ * @default true
509
+ */
510
+ autoJoinOneToOneOwner: boolean;
511
+ /**
512
+ * Automatically join M:1 and 1:1 relations when filters are defined on them.
513
+ * Important for implementing soft deletes via filters.
514
+ * @default true
515
+ */
516
+ autoJoinRefsForFilters: boolean;
517
+ /**
518
+ * Apply filters to relations in queries.
519
+ * @default true
520
+ */
521
+ filtersOnRelations: boolean;
522
+ /**
523
+ * Enable propagation of changes on entity prototypes.
524
+ * @default true
525
+ */
526
+ propagationOnPrototype: boolean;
527
+ /**
528
+ * Mark all relations as populated after flush for new entities.
529
+ * This aligns serialized output of loaded entities and just-inserted ones.
530
+ * @default true
531
+ */
532
+ populateAfterFlush: boolean;
533
+ /**
534
+ * Serialization options for `toJSON()` and `serialize()` methods.
535
+ */
536
+ serialization: {
537
+ /**
538
+ * Include primary keys in serialized output.
480
539
  * @default true
481
540
  */
482
- propagationOnPrototype: boolean;
541
+ includePrimaryKeys?: boolean;
483
542
  /**
484
- * Mark all relations as populated after flush for new entities.
485
- * This aligns serialized output of loaded entities and just-inserted ones.
486
- * @default true
487
- */
488
- populateAfterFlush: boolean;
489
- /**
490
- * Serialization options for `toJSON()` and `serialize()` methods.
491
- */
492
- serialization: {
493
- /**
494
- * Include primary keys in serialized output.
495
- * @default true
496
- */
497
- includePrimaryKeys?: boolean;
498
- /**
499
- * Enforce unpopulated references to be returned as objects.
500
- * When enabled, references are serialized as `{ author: { id: 1 } }` instead of `{ author: 1 }`.
501
- * @default false
502
- */
503
- forceObject?: boolean;
504
- };
505
- /**
506
- * Default options for entity assignment via `em.assign()`.
507
- * @see https://mikro-orm.io/docs/entity-helper
508
- */
509
- assign: AssignOptions<boolean>;
510
- /**
511
- * Automatically call `em.persist()` on entities created via `em.create()`.
512
- * @default true
513
- */
514
- persistOnCreate: boolean;
515
- /**
516
- * When upsert creates a new entity, mark it as managed in the identity map.
517
- * @default true
518
- */
519
- upsertManaged: boolean;
520
- /**
521
- * Force use of entity constructors when creating entity instances.
522
- * Required when using native private properties inside entities.
523
- * Can be `true` for all entities or an array of specific entity classes/names.
543
+ * Enforce unpopulated references to be returned as objects.
544
+ * When enabled, references are serialized as `{ author: { id: 1 } }` instead of `{ author: 1 }`.
524
545
  * @default false
525
546
  */
526
- forceEntityConstructor: boolean | (Constructor<AnyEntity> | string)[];
527
- /**
528
- * Convert `null` values from database to `undefined` when hydrating entities.
529
- * @default false
530
- */
531
- forceUndefined: boolean;
532
- /**
533
- * Property `onCreate` hooks are normally executed during `flush` operation.
534
- * With this option, they will be processed early inside `em.create()` method.
535
- * @default true
536
- */
537
- processOnCreateHooksEarly: boolean;
538
- /**
539
- * Force `Date` values to be stored in UTC for datetime columns without timezone.
540
- * Works for MySQL (`datetime` type), PostgreSQL (`timestamp` type), and MSSQL (`datetime`/`datetime2` types).
541
- * SQLite does this by default.
542
- * @default true
543
- */
544
- forceUtcTimezone: boolean;
545
- /**
546
- * Timezone to use for date operations.
547
- * @example '+02:00'
548
- */
549
- timezone?: string;
550
- /**
551
- * Ensure the database exists when initializing the ORM.
552
- * When `true`, will create the database if it doesn't exist.
553
- * @default true
554
- */
555
- ensureDatabase: boolean | EnsureDatabaseOptions;
556
- /**
557
- * Ensure database indexes exist on startup. This option works only with the MongoDB driver.
558
- * When enabled, indexes will be created based on entity metadata.
547
+ forceObject?: boolean;
548
+ };
549
+ /**
550
+ * Default options for entity assignment via `em.assign()`.
551
+ * @see https://mikro-orm.io/docs/entity-helper
552
+ */
553
+ assign: AssignOptions<boolean>;
554
+ /**
555
+ * Automatically call `em.persist()` on entities created via `em.create()`.
556
+ * @default true
557
+ */
558
+ persistOnCreate: boolean;
559
+ /**
560
+ * When upsert creates a new entity, mark it as managed in the identity map.
561
+ * @default true
562
+ */
563
+ upsertManaged: boolean;
564
+ /**
565
+ * Force use of entity constructors when creating entity instances.
566
+ * Required when using native private properties inside entities.
567
+ * Can be `true` for all entities or an array of specific entity classes/names.
568
+ * @default false
569
+ */
570
+ forceEntityConstructor: boolean | (Constructor<AnyEntity> | string)[];
571
+ /**
572
+ * Convert `null` values from database to `undefined` when hydrating entities.
573
+ * @default false
574
+ */
575
+ forceUndefined: boolean;
576
+ /**
577
+ * Property `onCreate` hooks are normally executed during `flush` operation.
578
+ * With this option, they will be processed early inside `em.create()` method.
579
+ * @default true
580
+ */
581
+ processOnCreateHooksEarly: boolean;
582
+ /**
583
+ * Force `Date` values to be stored in UTC for datetime columns without timezone.
584
+ * Works for MySQL (`datetime` type), PostgreSQL (`timestamp` type), and MSSQL (`datetime`/`datetime2` types).
585
+ * SQLite does this by default.
586
+ * @default true
587
+ */
588
+ forceUtcTimezone: boolean;
589
+ /**
590
+ * Timezone to use for date operations.
591
+ * @example '+02:00'
592
+ */
593
+ timezone?: string;
594
+ /**
595
+ * Ensure the database exists when initializing the ORM.
596
+ * When `true`, will create the database if it doesn't exist.
597
+ * @default true
598
+ */
599
+ ensureDatabase: boolean | EnsureDatabaseOptions;
600
+ /**
601
+ * Ensure database indexes exist on startup. This option works only with the MongoDB driver.
602
+ * When enabled, indexes will be created based on entity metadata.
603
+ * @default false
604
+ */
605
+ ensureIndexes: boolean;
606
+ /**
607
+ * Use batch insert queries for better performance.
608
+ * @default true
609
+ */
610
+ useBatchInserts?: boolean;
611
+ /**
612
+ * Use batch update queries for better performance.
613
+ * @default true
614
+ */
615
+ useBatchUpdates?: boolean;
616
+ /**
617
+ * Number of entities to process in each batch for batch inserts/updates.
618
+ * @default 300
619
+ */
620
+ batchSize: number;
621
+ /**
622
+ * Custom hydrator class for assigning database values to entities.
623
+ * @default ObjectHydrator
624
+ */
625
+ hydrator: HydratorConstructor;
626
+ /**
627
+ * Pre-generated compiled functions for hydration and comparison.
628
+ * Use the `compile` CLI command to create these functions.
629
+ * Enables deployment to runtimes that prohibit `new Function`/eval (e.g. Cloudflare Workers).
630
+ */
631
+ compiledFunctions?: CompiledFunctions;
632
+ /**
633
+ * Default loading strategy for relations.
634
+ * - `'joined'`: Use SQL JOINs (single query, may cause cartesian product)
635
+ * - `'select-in'`: Use separate SELECT IN queries (multiple queries)
636
+ * - `'balanced'`: Decides based on relation type and context.
637
+ * @default 'balanced'
638
+ */
639
+ loadStrategy: LoadStrategy | `${LoadStrategy}`;
640
+ /**
641
+ * Enable dataloader for batching reference loading.
642
+ * - `true` or `DataloaderType.ALL`: Enable for all relation types
643
+ * - `false` or `DataloaderType.NONE`: Disable dataloader
644
+ * - `DataloaderType.REFERENCE`: Enable only for scalar references
645
+ * - `DataloaderType.COLLECTION`: Enable only for collections
646
+ * @default DataloaderType.NONE
647
+ */
648
+ dataloader: DataloaderType | boolean;
649
+ /**
650
+ * Determines how where conditions are applied during population.
651
+ * - `'all'`: Populate all matching relations (default in v5+)
652
+ * - `'infer'`: Infer conditions from the original query (v4 behavior)
653
+ * @default 'all'
654
+ */
655
+ populateWhere: PopulateHint | `${PopulateHint}`;
656
+ /**
657
+ * Default flush mode for the entity manager.
658
+ * - `'commit'`: Flush only on explicit commit
659
+ * - `'auto'`: Flush before queries when needed
660
+ * - `'always'`: Always flush before queries
661
+ * @default 'auto'
662
+ */
663
+ flushMode: FlushMode | `${FlushMode}`;
664
+ /**
665
+ * Custom base repository class for all entities.
666
+ * Entity-specific repositories can still be defined and will take precedence.
667
+ * @see https://mikro-orm.io/docs/repositories
668
+ */
669
+ entityRepository?: EntityClass<EntityRepository<any>>;
670
+ /**
671
+ * Custom entity manager class to use.
672
+ */
673
+ entityManager?: Constructor<EM>;
674
+ /**
675
+ * Read replica connection configurations.
676
+ * Each replica can override parts of the main connection options.
677
+ * @see https://mikro-orm.io/docs/read-connections
678
+ */
679
+ replicas?: ConnectionOptions[];
680
+ /**
681
+ * Validate that required properties are set on new entities before insert.
682
+ * @default true
683
+ */
684
+ validateRequired: boolean;
685
+ /**
686
+ * Callback to get the current request context's EntityManager.
687
+ * Used for automatic context propagation in web frameworks.
688
+ * @default RequestContext.getEntityManager
689
+ */
690
+ context: (name: string) => EntityManager | undefined;
691
+ /**
692
+ * Name of the context for multi-ORM setups.
693
+ * @default 'default'
694
+ */
695
+ contextName: string;
696
+ /**
697
+ * Allow using the global EntityManager without a request context.
698
+ * Not recommended for production - each request should have its own context.
699
+ * Can also be set via `MIKRO_ORM_ALLOW_GLOBAL_CONTEXT` environment variable.
700
+ * @default false
701
+ */
702
+ allowGlobalContext: boolean;
703
+ /**
704
+ * When enabled, environment variables take precedence over explicitly provided config options.
705
+ * By default, explicit options win over env vars.
706
+ * @default false
707
+ */
708
+ preferEnvVars?: boolean;
709
+ /**
710
+ * Disable the identity map.
711
+ * When disabled, each query returns new entity instances.
712
+ * Not recommended for most use cases.
713
+ * @default false
714
+ */
715
+ disableIdentityMap?: boolean;
716
+ /**
717
+ * Custom logger function for ORM output.
718
+ * @default console.log
719
+ */
720
+ logger: (message: string) => void;
721
+ /**
722
+ * Enable colored output in logs.
723
+ * @default true
724
+ */
725
+ colors: boolean;
726
+ /**
727
+ * Factory function to create a custom logger instance.
728
+ * @default DefaultLogger.create
729
+ */
730
+ loggerFactory?: (options: LoggerOptions) => Logger;
731
+ /**
732
+ * Threshold in milliseconds for logging slow queries.
733
+ * Queries taking at least this long will be logged via the 'slow-query' namespace at warning level.
734
+ * Slow query logs are always emitted when the threshold is met, regardless of the `debug` setting.
735
+ * Set to `0` to log every query as slow.
736
+ * @default undefined (slow query logging disabled)
737
+ */
738
+ slowQueryThreshold?: number;
739
+ /**
740
+ * Factory function to create a custom logger instance for slow queries.
741
+ * Has the same shape as `loggerFactory`. When not provided, the main logger instance is used.
742
+ *
743
+ * Note: slow query log entries are emitted with `context.enabled = true` to bypass the
744
+ * debug-mode check. Custom logger implementations must respect `context.enabled` in their
745
+ * `isEnabled()` method (as `DefaultLogger` does) to ensure slow query logs are always emitted.
746
+ * @default undefined (falls back to main logger)
747
+ */
748
+ slowQueryLoggerFactory?: (options: LoggerOptions) => Logger;
749
+ /**
750
+ * Custom error handler for `em.findOneOrFail()` when no entity is found.
751
+ * @param entityName - Name of the entity being queried
752
+ * @param where - Query conditions
753
+ * @returns Error instance to throw
754
+ */
755
+ findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
756
+ /**
757
+ * Custom error handler for `em.findExactlyOneOrFail()` when entity count is not exactly one.
758
+ * Used when strict mode is enabled.
759
+ * @param entityName - Name of the entity being queried
760
+ * @param where - Query conditions
761
+ * @returns Error instance to throw
762
+ */
763
+ findExactlyOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
764
+ /**
765
+ * Enable debug logging.
766
+ * Can be `true` for all namespaces or an array of specific namespaces.
767
+ * Available namespaces: `'query'`, `'query-params'`, `'discovery'`, `'info'`.
768
+ * @default false
769
+ * @see https://mikro-orm.io/docs/logging
770
+ */
771
+ debug: boolean | LoggerNamespace[];
772
+ /**
773
+ * Ignore deprecation warnings.
774
+ * Can be `true` to ignore all or an array of specific deprecation labels.
775
+ * @default false
776
+ * @see https://mikro-orm.io/docs/logging#deprecation-warnings
777
+ */
778
+ ignoreDeprecations: boolean | string[];
779
+ /**
780
+ * Syntax highlighter for SQL queries in logs.
781
+ * @default NullHighlighter
782
+ */
783
+ highlighter: Highlighter;
784
+ /**
785
+ * Force the ORM to use TypeScript options regardless of detection.
786
+ * Uses `entitiesTs` for discovery and `pathTs` for migrations/seeders.
787
+ * Should only be used for tests, not production builds.
788
+ * @default false
789
+ */
790
+ preferTs?: boolean;
791
+ /**
792
+ * Base directory for resolving relative paths.
793
+ * @default process.cwd()
794
+ */
795
+ baseDir: string;
796
+ /**
797
+ * Migration configuration options.
798
+ * @see https://mikro-orm.io/docs/migrations
799
+ */
800
+ migrations: MigrationsOptions;
801
+ /**
802
+ * Schema generator configuration options.
803
+ */
804
+ schemaGenerator: {
805
+ /**
806
+ * Try to disable foreign key checks during schema operations.
559
807
  * @default false
560
808
  */
561
- ensureIndexes: boolean;
562
- /**
563
- * Use batch insert queries for better performance.
564
- * @default true
565
- */
566
- useBatchInserts?: boolean;
567
- /**
568
- * Use batch update queries for better performance.
569
- * @default true
570
- */
571
- useBatchUpdates?: boolean;
572
- /**
573
- * Number of entities to process in each batch for batch inserts/updates.
574
- * @default 300
575
- */
576
- batchSize: number;
577
- /**
578
- * Custom hydrator class for assigning database values to entities.
579
- * @default ObjectHydrator
580
- */
581
- hydrator: HydratorConstructor;
582
- /**
583
- * Pre-generated compiled functions for hydration and comparison.
584
- * Use the `compile` CLI command to create these functions.
585
- * Enables deployment to runtimes that prohibit `new Function`/eval (e.g. Cloudflare Workers).
586
- */
587
- compiledFunctions?: CompiledFunctions;
588
- /**
589
- * Default loading strategy for relations.
590
- * - `'joined'`: Use SQL JOINs (single query, may cause cartesian product)
591
- * - `'select-in'`: Use separate SELECT IN queries (multiple queries)
592
- * - `'balanced'`: Decides based on relation type and context.
593
- * @default 'balanced'
594
- */
595
- loadStrategy: LoadStrategy | `${LoadStrategy}`;
596
- /**
597
- * Enable dataloader for batching reference loading.
598
- * - `true` or `DataloaderType.ALL`: Enable for all relation types
599
- * - `false` or `DataloaderType.NONE`: Disable dataloader
600
- * - `DataloaderType.REFERENCE`: Enable only for scalar references
601
- * - `DataloaderType.COLLECTION`: Enable only for collections
602
- * @default DataloaderType.NONE
603
- */
604
- dataloader: DataloaderType | boolean;
605
- /**
606
- * Determines how where conditions are applied during population.
607
- * - `'all'`: Populate all matching relations (default in v5+)
608
- * - `'infer'`: Infer conditions from the original query (v4 behavior)
609
- * @default 'all'
610
- */
611
- populateWhere: PopulateHint | `${PopulateHint}`;
612
- /**
613
- * Default flush mode for the entity manager.
614
- * - `'commit'`: Flush only on explicit commit
615
- * - `'auto'`: Flush before queries when needed
616
- * - `'always'`: Always flush before queries
617
- * @default 'auto'
618
- */
619
- flushMode: FlushMode | `${FlushMode}`;
620
- /**
621
- * Custom base repository class for all entities.
622
- * Entity-specific repositories can still be defined and will take precedence.
623
- * @see https://mikro-orm.io/docs/repositories
624
- */
625
- entityRepository?: EntityClass<EntityRepository<any>>;
626
- /**
627
- * Custom entity manager class to use.
628
- */
629
- entityManager?: Constructor<EM>;
809
+ disableForeignKeys?: boolean;
630
810
  /**
631
- * Read replica connection configurations.
632
- * Each replica can override parts of the main connection options.
633
- * @see https://mikro-orm.io/docs/read-connections
811
+ * Try to disable foreign key checks during `schema.clear()`. Enabled by default for MySQL/MariaDB.
634
812
  */
635
- replicas?: ConnectionOptions[];
813
+ disableForeignKeysForClear?: boolean;
636
814
  /**
637
- * Validate that required properties are set on new entities before insert.
815
+ * Generate foreign key constraints.
638
816
  * @default true
639
817
  */
640
- validateRequired: boolean;
641
- /**
642
- * Callback to get the current request context's EntityManager.
643
- * Used for automatic context propagation in web frameworks.
644
- * @default RequestContext.getEntityManager
645
- */
646
- context: (name: string) => EntityManager | undefined;
647
- /**
648
- * Name of the context for multi-ORM setups.
649
- * @default 'default'
650
- */
651
- contextName: string;
818
+ createForeignKeyConstraints?: boolean;
652
819
  /**
653
- * Allow using the global EntityManager without a request context.
654
- * Not recommended for production - each request should have its own context.
655
- * Can also be set via `MIKRO_ORM_ALLOW_GLOBAL_CONTEXT` environment variable.
656
- * @default false
657
- */
658
- allowGlobalContext: boolean;
659
- /**
660
- * When enabled, environment variables take precedence over explicitly provided config options.
661
- * By default, explicit options win over env vars.
662
- * @default false
820
+ * Schema names to ignore when comparing schemas.
821
+ * @default []
663
822
  */
664
- preferEnvVars?: boolean;
823
+ ignoreSchema?: string[];
665
824
  /**
666
- * Disable the identity map.
667
- * When disabled, each query returns new entity instances.
668
- * Not recommended for most use cases.
669
- * @default false
825
+ * Table names or patterns to skip during schema generation.
826
+ * @default []
670
827
  */
671
- disableIdentityMap?: boolean;
828
+ skipTables?: (string | RegExp)[];
672
829
  /**
673
- * Custom logger function for ORM output.
674
- * @default console.log
830
+ * View names or patterns to skip during schema generation (e.g. PostGIS system views).
831
+ * @default []
675
832
  */
676
- logger: (message: string) => void;
833
+ skipViews?: (string | RegExp)[];
677
834
  /**
678
- * Enable colored output in logs.
679
- * @default true
835
+ * Column names or patterns to skip during schema generation, keyed by table name.
836
+ * @default {}
680
837
  */
681
- colors: boolean;
838
+ skipColumns?: Dictionary<(string | RegExp)[]>;
682
839
  /**
683
- * Factory function to create a custom logger instance.
684
- * @default DefaultLogger.create
840
+ * Database name to use for management operations (e.g., creating/dropping databases).
685
841
  */
686
- loggerFactory?: (options: LoggerOptions) => Logger;
842
+ managementDbName?: string;
687
843
  /**
688
- * Threshold in milliseconds for logging slow queries.
689
- * Queries taking at least this long will be logged via the 'slow-query' namespace at warning level.
690
- * Slow query logs are always emitted when the threshold is met, regardless of the `debug` setting.
691
- * Set to `0` to log every query as slow.
692
- * @default undefined (slow query logging disabled)
844
+ * Default ON UPDATE rule for foreign keys.
845
+ * When not set, no rule is emitted and the database uses its native default (NO ACTION/RESTRICT).
693
846
  */
694
- slowQueryThreshold?: number;
847
+ defaultUpdateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | 'restrict';
695
848
  /**
696
- * Factory function to create a custom logger instance for slow queries.
697
- * Has the same shape as `loggerFactory`. When not provided, the main logger instance is used.
698
- *
699
- * Note: slow query log entries are emitted with `context.enabled = true` to bypass the
700
- * debug-mode check. Custom logger implementations must respect `context.enabled` in their
701
- * `isEnabled()` method (as `DefaultLogger` does) to ensure slow query logs are always emitted.
702
- * @default undefined (falls back to main logger)
849
+ * Default ON DELETE rule for foreign keys.
850
+ * When not set, no rule is emitted and the database uses its native default (NO ACTION/RESTRICT).
703
851
  */
704
- slowQueryLoggerFactory?: (options: LoggerOptions) => Logger;
852
+ defaultDeleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | 'restrict';
853
+ tableSpace?: string;
854
+ };
855
+ /**
856
+ * Embeddable entity configuration options.
857
+ */
858
+ embeddables: {
705
859
  /**
706
- * Custom error handler for `em.findOneOrFail()` when no entity is found.
707
- * @param entityName - Name of the entity being queried
708
- * @param where - Query conditions
709
- * @returns Error instance to throw
860
+ * Mode for generating column prefixes for embedded properties.
861
+ * @default 'relative'
710
862
  */
711
- findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
863
+ prefixMode: EmbeddedPrefixMode;
864
+ };
865
+ /**
866
+ * Entity generator (code generation) configuration options.
867
+ * @see https://mikro-orm.io/docs/entity-generator
868
+ */
869
+ entityGenerator: GenerateOptions;
870
+ /**
871
+ * Metadata cache configuration for improved startup performance.
872
+ * @see https://mikro-orm.io/docs/metadata-cache
873
+ */
874
+ metadataCache: {
712
875
  /**
713
- * Custom error handler for `em.findExactlyOneOrFail()` when entity count is not exactly one.
714
- * Used when strict mode is enabled.
715
- * @param entityName - Name of the entity being queried
716
- * @param where - Query conditions
717
- * @returns Error instance to throw
876
+ * Enable metadata caching.
877
+ * Defaults based on the metadata provider's `useCache()` method.
718
878
  */
719
- findExactlyOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
879
+ enabled?: boolean;
720
880
  /**
721
- * Enable debug logging.
722
- * Can be `true` for all namespaces or an array of specific namespaces.
723
- * Available namespaces: `'query'`, `'query-params'`, `'discovery'`, `'info'`.
724
- * @default false
725
- * @see https://mikro-orm.io/docs/logging
881
+ * Combine all metadata into a single cache file.
882
+ * Can be `true` for default path or a custom path string.
726
883
  */
727
- debug: boolean | LoggerNamespace[];
884
+ combined?: boolean | string;
728
885
  /**
729
- * Ignore deprecation warnings.
730
- * Can be `true` to ignore all or an array of specific deprecation labels.
886
+ * Pretty print JSON cache files.
731
887
  * @default false
732
- * @see https://mikro-orm.io/docs/logging#deprecation-warnings
733
888
  */
734
- ignoreDeprecations: boolean | string[];
889
+ pretty?: boolean;
735
890
  /**
736
- * Syntax highlighter for SQL queries in logs.
737
- * @default NullHighlighter
891
+ * Cache adapter class to use. When cache is enabled, and no adapter is provided explicitly, {@link FileCacheAdapter} is used automatically - but only if you use the async `MikroORM.init()` method.
738
892
  */
739
- highlighter: Highlighter;
740
- /**
741
- * Force the ORM to use TypeScript options regardless of detection.
742
- * Uses `entitiesTs` for discovery and `pathTs` for migrations/seeders.
743
- * Should only be used for tests, not production builds.
744
- * @default false
745
- */
746
- preferTs?: boolean;
747
- /**
748
- * Base directory for resolving relative paths.
749
- * @default process.cwd()
750
- */
751
- baseDir: string;
752
- /**
753
- * Migration configuration options.
754
- * @see https://mikro-orm.io/docs/migrations
755
- */
756
- migrations: MigrationsOptions;
757
- /**
758
- * Schema generator configuration options.
759
- */
760
- schemaGenerator: {
761
- /**
762
- * Try to disable foreign key checks during schema operations.
763
- * @default false
764
- */
765
- disableForeignKeys?: boolean;
766
- /**
767
- * Try to disable foreign key checks during `schema.clear()`. Enabled by default for MySQL/MariaDB.
768
- */
769
- disableForeignKeysForClear?: boolean;
770
- /**
771
- * Generate foreign key constraints.
772
- * @default true
773
- */
774
- createForeignKeyConstraints?: boolean;
775
- /**
776
- * Schema names to ignore when comparing schemas.
777
- * @default []
778
- */
779
- ignoreSchema?: string[];
780
- /**
781
- * Table names or patterns to skip during schema generation.
782
- * @default []
783
- */
784
- skipTables?: (string | RegExp)[];
785
- /**
786
- * View names or patterns to skip during schema generation (e.g. PostGIS system views).
787
- * @default []
788
- */
789
- skipViews?: (string | RegExp)[];
790
- /**
791
- * Column names or patterns to skip during schema generation, keyed by table name.
792
- * @default {}
793
- */
794
- skipColumns?: Dictionary<(string | RegExp)[]>;
795
- /**
796
- * Database name to use for management operations (e.g., creating/dropping databases).
797
- */
798
- managementDbName?: string;
799
- /**
800
- * Default ON UPDATE rule for foreign keys.
801
- * When not set, no rule is emitted and the database uses its native default (NO ACTION/RESTRICT).
802
- */
803
- defaultUpdateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | 'restrict';
804
- /**
805
- * Default ON DELETE rule for foreign keys.
806
- * When not set, no rule is emitted and the database uses its native default (NO ACTION/RESTRICT).
807
- */
808
- defaultDeleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | 'restrict';
809
- tableSpace?: string;
810
- };
811
- /**
812
- * Embeddable entity configuration options.
813
- */
814
- embeddables: {
815
- /**
816
- * Mode for generating column prefixes for embedded properties.
817
- * @default 'relative'
818
- */
819
- prefixMode: EmbeddedPrefixMode;
893
+ adapter?: {
894
+ new (...params: any[]): SyncCacheAdapter;
820
895
  };
821
896
  /**
822
- * Entity generator (code generation) configuration options.
823
- * @see https://mikro-orm.io/docs/entity-generator
897
+ * Options passed to the cache adapter constructor.
898
+ * @default { cacheDir: process.cwd() + '/temp' }
824
899
  */
825
- entityGenerator: GenerateOptions;
826
- /**
827
- * Metadata cache configuration for improved startup performance.
828
- * @see https://mikro-orm.io/docs/metadata-cache
829
- */
830
- metadataCache: {
831
- /**
832
- * Enable metadata caching.
833
- * Defaults based on the metadata provider's `useCache()` method.
834
- */
835
- enabled?: boolean;
836
- /**
837
- * Combine all metadata into a single cache file.
838
- * Can be `true` for default path or a custom path string.
839
- */
840
- combined?: boolean | string;
841
- /**
842
- * Pretty print JSON cache files.
843
- * @default false
844
- */
845
- pretty?: boolean;
846
- /**
847
- * Cache adapter class to use. When cache is enabled, and no adapter is provided explicitly, {@link FileCacheAdapter} is used automatically - but only if you use the async `MikroORM.init()` method.
848
- */
849
- adapter?: {
850
- new (...params: any[]): SyncCacheAdapter;
851
- };
852
- /**
853
- * Options passed to the cache adapter constructor.
854
- * @default { cacheDir: process.cwd() + '/temp' }
855
- */
856
- options?: Dictionary;
857
- };
900
+ options?: Dictionary;
901
+ };
902
+ /**
903
+ * Result cache configuration for query result caching.
904
+ */
905
+ resultCache: {
858
906
  /**
859
- * Result cache configuration for query result caching.
907
+ * Default cache expiration time in milliseconds.
908
+ * @default 1000
860
909
  */
861
- resultCache: {
862
- /**
863
- * Default cache expiration time in milliseconds.
864
- * @default 1000
865
- */
866
- expiration?: number;
867
- /**
868
- * Cache adapter class to use.
869
- * @default MemoryCacheAdapter
870
- */
871
- adapter?: {
872
- new (...params: any[]): CacheAdapter;
873
- };
874
- /**
875
- * Options passed to the cache adapter constructor.
876
- * @default {}
877
- */
878
- options?: Dictionary;
879
- /**
880
- * Enable global result caching for all queries.
881
- * Can be `true`, an expiration number, or a tuple of `[key, expiration]`.
882
- */
883
- global?: boolean | number | [string, number];
884
- };
910
+ expiration?: number;
885
911
  /**
886
- * Metadata provider class for entity discovery.
887
- * Built-in options: `ReflectMetadataProvider` (default), `TsMorphMetadataProvider`.
888
- * @default ReflectMetadataProvider
889
- * @see https://mikro-orm.io/docs/metadata-providers
912
+ * Cache adapter class to use.
913
+ * @default MemoryCacheAdapter
890
914
  */
891
- metadataProvider: {
892
- new (config: Configuration): MetadataProvider;
893
- useCache?: MetadataProvider['useCache'];
915
+ adapter?: {
916
+ new (...params: any[]): CacheAdapter;
894
917
  };
895
918
  /**
896
- * Seeder configuration options.
897
- * @see https://mikro-orm.io/docs/seeding
898
- */
899
- seeder: SeederOptions;
900
- /**
901
- * Prefer read replicas for read operations when available.
902
- * @default true
903
- */
904
- preferReadReplicas: boolean;
905
- /**
906
- * Custom dynamic import provider for loading modules.
907
- * @default (id) => import(id)
908
- */
909
- dynamicImportProvider: (id: string) => Promise<unknown>;
919
+ * Options passed to the cache adapter constructor.
920
+ * @default {}
921
+ */
922
+ options?: Dictionary;
923
+ /**
924
+ * Enable global result caching for all queries.
925
+ * Can be `true`, an expiration number, or a tuple of `[key, expiration]`.
926
+ */
927
+ global?: boolean | number | [string, number];
928
+ };
929
+ /**
930
+ * Metadata provider class for entity discovery.
931
+ * Built-in options: `ReflectMetadataProvider` (default), `TsMorphMetadataProvider`.
932
+ * @default ReflectMetadataProvider
933
+ * @see https://mikro-orm.io/docs/metadata-providers
934
+ */
935
+ metadataProvider: {
936
+ new (config: Configuration): MetadataProvider;
937
+ useCache?: MetadataProvider['useCache'];
938
+ };
939
+ /**
940
+ * Seeder configuration options.
941
+ * @see https://mikro-orm.io/docs/seeding
942
+ */
943
+ seeder: SeederOptions;
944
+ /**
945
+ * Prefer read replicas for read operations when available.
946
+ * @default true
947
+ */
948
+ preferReadReplicas: boolean;
949
+ /**
950
+ * Custom dynamic import provider for loading modules.
951
+ * @default (id) => import(id)
952
+ */
953
+ dynamicImportProvider: (id: string) => Promise<unknown>;
910
954
  }