@mikro-orm/core 7.2.0-dev.7 → 7.2.0-dev.9
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.
- package/MikroORM.d.ts +4 -0
- package/MikroORM.js +6 -0
- package/metadata/MetadataDiscovery.js +6 -1
- package/package.json +1 -1
- package/utils/Utils.js +1 -1
package/MikroORM.d.ts
CHANGED
|
@@ -82,6 +82,10 @@ export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver,
|
|
|
82
82
|
* Closes the database connection.
|
|
83
83
|
*/
|
|
84
84
|
close(force?: boolean): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Closes the database connection, allows using the ORM instance with `await using`.
|
|
87
|
+
*/
|
|
88
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
85
89
|
/**
|
|
86
90
|
* Gets the `MetadataStorage`.
|
|
87
91
|
*/
|
package/MikroORM.js
CHANGED
|
@@ -159,6 +159,12 @@ export class MikroORM {
|
|
|
159
159
|
await this.config.getMetadataCacheAdapter()?.close?.();
|
|
160
160
|
await this.config.getResultCacheAdapter()?.close?.();
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Closes the database connection, allows using the ORM instance with `await using`.
|
|
164
|
+
*/
|
|
165
|
+
async [Symbol.asyncDispose]() {
|
|
166
|
+
await this.close();
|
|
167
|
+
}
|
|
162
168
|
/**
|
|
163
169
|
* Gets the `MetadataStorage` (without parameters) or `EntityMetadata` instance when provided with the `entityName` parameter.
|
|
164
170
|
*/
|
|
@@ -956,6 +956,11 @@ export class MetadataDiscovery {
|
|
|
956
956
|
return primaryProp;
|
|
957
957
|
}
|
|
958
958
|
definePivotProperty(prop, name, type, inverse, owner, selfReferencing) {
|
|
959
|
+
let index = prop.index ?? this.#platform.indexForeignKeys();
|
|
960
|
+
if (owner && prop.index) {
|
|
961
|
+
// owner join columns are the leading prefix of the composite PK, so an explicit `index` only applies to them with `fixedOrder`; a custom index name always belongs to the inverse side
|
|
962
|
+
index = prop.fixedOrder ? true : this.#platform.indexForeignKeys();
|
|
963
|
+
}
|
|
959
964
|
const ret = {
|
|
960
965
|
name,
|
|
961
966
|
type: Utils.className(type),
|
|
@@ -964,7 +969,7 @@ export class MetadataDiscovery {
|
|
|
964
969
|
cascade: [Cascade.ALL],
|
|
965
970
|
fixedOrder: prop.fixedOrder,
|
|
966
971
|
fixedOrderColumn: prop.fixedOrderColumn,
|
|
967
|
-
index
|
|
972
|
+
index,
|
|
968
973
|
primary: !prop.fixedOrder,
|
|
969
974
|
autoincrement: false,
|
|
970
975
|
updateRule: prop.updateRule,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.2.0-dev.
|
|
3
|
+
"version": "7.2.0-dev.9",
|
|
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.0-dev.
|
|
156
|
+
static #ORM_VERSION = '7.2.0-dev.9';
|
|
157
157
|
/**
|
|
158
158
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
159
159
|
*/
|