@mikro-orm/core 7.1.11-dev.0 → 7.1.11-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.1.11-dev.0",
3
+ "version": "7.1.11-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",
package/typings.d.ts CHANGED
@@ -1470,6 +1470,8 @@ export interface IMigrationGenerator {
1470
1470
  }
1471
1471
  /** Interface that all migration classes must implement. */
1472
1472
  export interface Migration {
1473
+ /** Stable migration name, used instead of the class name (which minifiers can mangle). */
1474
+ name?: string;
1473
1475
  up(): Promise<void> | void;
1474
1476
  down(): Promise<void> | void;
1475
1477
  isTransactional(): boolean;
@@ -103,7 +103,7 @@ export declare abstract class AbstractMigrator<D extends IDatabaseDriver> implem
103
103
  name: string;
104
104
  path: string;
105
105
  }): RunnableMigration;
106
- protected initialize(MigrationClass: Constructor<Migration>, name: string): RunnableMigration;
106
+ protected initialize(MigrationClass: Constructor<Migration>, name?: string): RunnableMigration;
107
107
  /**
108
108
  * Checks if `src` folder exists, it so, tries to adjust the migrations and seeders paths automatically to use it.
109
109
  * If there is a `dist` or `build` folder, it will be used for the JS variant (`path` option), while the `src` folder will be
@@ -358,7 +358,8 @@ export class AbstractMigrator {
358
358
  initialize(MigrationClass, name) {
359
359
  const instance = new MigrationClass(this.driver, this.config);
360
360
  return {
361
- name: this.storage.getMigrationName(name),
361
+ // the constructor name is the last resort, minifiers can mangle it (e.g. when bundling)
362
+ name: this.storage.getMigrationName(name ?? instance.name ?? MigrationClass.name),
362
363
  up: afterRun => this.runner.run(instance, 'up', afterRun),
363
364
  down: afterRun => this.runner.run(instance, 'down', afterRun),
364
365
  };
@@ -409,7 +410,7 @@ export class AbstractMigrator {
409
410
  if (this.options.migrationsList) {
410
411
  return this.options.migrationsList.map(migration => {
411
412
  if (typeof migration === 'function') {
412
- return this.initialize(migration, migration.name);
413
+ return this.initialize(migration);
413
414
  }
414
415
  return this.initialize(migration.class, migration.name);
415
416
  });
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.1.11-dev.0';
156
+ static #ORM_VERSION = '7.1.11-dev.1';
157
157
  /**
158
158
  * Checks if the argument is instance of `Object`. Returns false for arrays.
159
159
  */