@mikro-orm/migrations 6.6.11 → 6.6.12-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.
Files changed (2) hide show
  1. package/Migrator.js +4 -3
  2. package/package.json +3 -3
package/Migrator.js CHANGED
@@ -343,18 +343,19 @@ class Migrator {
343
343
  }
344
344
  async runMigrations(method, options) {
345
345
  await this.ensureDatabase();
346
+ // Save transaction reference before prefix() deletes it from options
347
+ const ctx = core_1.Utils.isObject(options) ? options.transaction : undefined;
346
348
  let result;
347
349
  if (!this.options.transactional || !this.options.allOrNothing) {
348
350
  result = await this.umzug[method](this.prefix(options));
349
351
  }
350
- else if (core_1.Utils.isObject(options) && options.transaction) {
351
- result = await this.runInTransaction(options.transaction, method, options);
352
+ else if (ctx) {
353
+ result = await this.runInTransaction(ctx, method, options);
352
354
  }
353
355
  else {
354
356
  result = await this.driver.getConnection().transactional(trx => this.runInTransaction(trx, method, options));
355
357
  }
356
358
  if (result.length > 0 && this.options.snapshot) {
357
- const ctx = core_1.Utils.isObject(options) ? options.transaction : undefined;
358
359
  const schema = await knex_1.DatabaseSchema.create(this.em.getConnection(), this.em.getPlatform(), this.config, undefined, undefined, undefined, undefined, ctx);
359
360
  try {
360
361
  await this.storeCurrentSchema(schema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/migrations",
3
- "version": "6.6.11",
3
+ "version": "6.6.12-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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -58,7 +58,7 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@mikro-orm/knex": "6.6.11",
61
+ "@mikro-orm/knex": "6.6.12-dev.1",
62
62
  "fs-extra": "11.3.3",
63
63
  "umzug": "3.8.2"
64
64
  },
@@ -66,6 +66,6 @@
66
66
  "@mikro-orm/core": "^6.6.11"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "^6.0.0"
69
+ "@mikro-orm/core": "6.6.12-dev.1"
70
70
  }
71
71
  }