@mikro-orm/core 7.1.8-dev.9 → 7.2.0-dev.1
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/package.json +1 -1
- package/utils/AbstractMigrator.d.ts +2 -0
- package/utils/AbstractMigrator.js +11 -1
- package/utils/Utils.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0-dev.1",
|
|
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",
|
|
@@ -95,6 +95,8 @@ export declare abstract class AbstractMigrator<D extends IDatabaseDriver> implem
|
|
|
95
95
|
*/
|
|
96
96
|
unlogMigration(name: string): Promise<void>;
|
|
97
97
|
protected init(): Promise<void>;
|
|
98
|
+
/** Resolves the migrations path (including source folder auto-detection) without touching the filesystem. */
|
|
99
|
+
protected resolvePaths(): Promise<void>;
|
|
98
100
|
protected initPaths(): Promise<void>;
|
|
99
101
|
protected initServices(): void;
|
|
100
102
|
protected resolve(params: {
|
|
@@ -9,6 +9,7 @@ export class AbstractMigrator {
|
|
|
9
9
|
options;
|
|
10
10
|
absolutePath;
|
|
11
11
|
initialized = false;
|
|
12
|
+
#pathsEnsured = false;
|
|
12
13
|
#listeners = new Map();
|
|
13
14
|
constructor(em) {
|
|
14
15
|
this.em = em;
|
|
@@ -303,7 +304,8 @@ export class AbstractMigrator {
|
|
|
303
304
|
this.initialized = true;
|
|
304
305
|
await this.initPaths();
|
|
305
306
|
}
|
|
306
|
-
|
|
307
|
+
/** Resolves the migrations path (including source folder auto-detection) without touching the filesystem. */
|
|
308
|
+
async resolvePaths() {
|
|
307
309
|
if (this.absolutePath || this.options.migrationsList) {
|
|
308
310
|
return;
|
|
309
311
|
}
|
|
@@ -312,6 +314,14 @@ export class AbstractMigrator {
|
|
|
312
314
|
/* v8 ignore next */
|
|
313
315
|
const key = this.config.get('preferTs', Utils.detectTypeScriptSupport()) && this.options.pathTs ? 'pathTs' : 'path';
|
|
314
316
|
this.absolutePath = fs.absolutePath(this.options[key], this.config.get('baseDir'));
|
|
317
|
+
}
|
|
318
|
+
async initPaths() {
|
|
319
|
+
await this.resolvePaths();
|
|
320
|
+
if (this.#pathsEnsured || this.options.migrationsList) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
this.#pathsEnsured = true;
|
|
324
|
+
const { fs } = await import('@mikro-orm/core/fs-utils');
|
|
315
325
|
try {
|
|
316
326
|
fs.ensureDir(this.absolutePath);
|
|
317
327
|
}
|
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.
|
|
156
|
+
static #ORM_VERSION = '7.2.0-dev.1';
|
|
157
157
|
/**
|
|
158
158
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
159
159
|
*/
|