@mikro-orm/migrations-mongodb 7.0.0-dev.107 → 7.0.0-dev.108
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/MigrationGenerator.js +1 -2
- package/Migrator.js +2 -2
- package/package.json +3 -3
package/MigrationGenerator.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Utils, } from '@mikro-orm/core';
|
|
2
1
|
import { fs } from '@mikro-orm/core/fs-utils';
|
|
3
2
|
import { writeFile } from 'node:fs/promises';
|
|
4
3
|
export class MigrationGenerator {
|
|
@@ -16,7 +15,7 @@ export class MigrationGenerator {
|
|
|
16
15
|
async generate(diff, path, name) {
|
|
17
16
|
/* v8 ignore next */
|
|
18
17
|
const defaultPath = this.options.emit === 'ts' && this.options.pathTs ? this.options.pathTs : this.options.path;
|
|
19
|
-
path =
|
|
18
|
+
path = fs.normalizePath(this.driver.config.get('baseDir'), path ?? defaultPath);
|
|
20
19
|
fs.ensureDir(path);
|
|
21
20
|
const timestamp = new Date().toISOString().replace(/[-T:]|\.\d{3}z$/ig, '');
|
|
22
21
|
const className = this.namingStrategy.classToMigrationName(timestamp, name);
|
package/Migrator.js
CHANGED
|
@@ -24,7 +24,7 @@ export class Migrator {
|
|
|
24
24
|
this.detectSourceFolder();
|
|
25
25
|
/* v8 ignore next */
|
|
26
26
|
const key = (this.config.get('preferTs', Utils.detectTypeScriptSupport()) && this.options.pathTs) ? 'pathTs' : 'path';
|
|
27
|
-
this.absolutePath =
|
|
27
|
+
this.absolutePath = fs.absolutePath(this.options[key], this.config.get('baseDir'));
|
|
28
28
|
this.createUmzug();
|
|
29
29
|
}
|
|
30
30
|
static register(orm) {
|
|
@@ -165,7 +165,7 @@ export class Migrator {
|
|
|
165
165
|
}
|
|
166
166
|
resolve(params) {
|
|
167
167
|
const createMigrationHandler = async (method) => {
|
|
168
|
-
const migration = await
|
|
168
|
+
const migration = await fs.dynamicImport(params.path);
|
|
169
169
|
const MigrationClass = Object.values(migration).find(cls => typeof cls === 'function' && typeof cls.constructor === 'function');
|
|
170
170
|
const instance = new MigrationClass(this.driver, this.config);
|
|
171
171
|
await this.runner.run(instance, method);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/migrations-mongodb",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
4
|
+
"version": "7.0.0-dev.108",
|
|
5
5
|
"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.",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@mikro-orm/mongodb": "7.0.0-dev.
|
|
53
|
+
"@mikro-orm/mongodb": "7.0.0-dev.108",
|
|
54
54
|
"mongodb": "7.0.0",
|
|
55
55
|
"umzug": "3.8.2"
|
|
56
56
|
},
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"@mikro-orm/core": "^6.6.2"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@mikro-orm/core": "7.0.0-dev.
|
|
61
|
+
"@mikro-orm/core": "7.0.0-dev.108"
|
|
62
62
|
}
|
|
63
63
|
}
|