@mikro-orm/core 7.0.11-dev.14 → 7.0.11-dev.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.0.11-dev.14",
3
+ "version": "7.0.11-dev.15",
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",
@@ -72,6 +72,7 @@ export declare abstract class AbstractMigrator<D extends IDatabaseDriver> implem
72
72
  down(options?: string | string[] | Omit<MigrateOptions, 'from'>): Promise<MigrationInfo[]>;
73
73
  abstract getStorage(): IMigratorStorage;
74
74
  protected init(): Promise<void>;
75
+ protected initPaths(): Promise<void>;
75
76
  protected initServices(): void;
76
77
  protected resolve(params: {
77
78
  name: string;
@@ -89,7 +90,7 @@ export declare abstract class AbstractMigrator<D extends IDatabaseDriver> implem
89
90
  private detectSourceFolder;
90
91
  private registerDefaultListeners;
91
92
  private emit;
92
- private discoverMigrations;
93
+ protected discoverMigrations(): Promise<RunnableMigration[]>;
93
94
  private executeMigrations;
94
95
  private filterUp;
95
96
  private filterDown;
@@ -68,14 +68,24 @@ export class AbstractMigrator {
68
68
  return;
69
69
  }
70
70
  this.initialized = true;
71
- if (!this.options.migrationsList) {
72
- const { fs } = await import('@mikro-orm/core/fs-utils');
73
- this.detectSourceFolder(fs);
74
- /* v8 ignore next */
75
- const key = this.config.get('preferTs', Utils.detectTypeScriptSupport()) && this.options.pathTs ? 'pathTs' : 'path';
76
- this.absolutePath = fs.absolutePath(this.options[key], this.config.get('baseDir'));
71
+ await this.initPaths();
72
+ }
73
+ async initPaths() {
74
+ if (this.absolutePath || this.options.migrationsList) {
75
+ return;
76
+ }
77
+ const { fs } = await import('@mikro-orm/core/fs-utils');
78
+ this.detectSourceFolder(fs);
79
+ /* v8 ignore next */
80
+ const key = this.config.get('preferTs', Utils.detectTypeScriptSupport()) && this.options.pathTs ? 'pathTs' : 'path';
81
+ this.absolutePath = fs.absolutePath(this.options[key], this.config.get('baseDir'));
82
+ try {
77
83
  fs.ensureDir(this.absolutePath);
78
84
  }
85
+ catch {
86
+ // read-only filesystem — read-only operations (e.g. `getPending` with a
87
+ // snapshot) may still succeed; write operations will fail on their own
88
+ }
79
89
  }
80
90
  initServices() {
81
91
  this.runner = this.createRunner();
package/utils/Utils.js CHANGED
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
141
141
  /** Collection of general-purpose utility methods used throughout the ORM. */
142
142
  export class Utils {
143
143
  static PK_SEPARATOR = '~~~';
144
- static #ORM_VERSION = '7.0.11-dev.14';
144
+ static #ORM_VERSION = '7.0.11-dev.15';
145
145
  /**
146
146
  * Checks if the argument is instance of `Object`. Returns false for arrays.
147
147
  */