@mikro-orm/migrations 6.6.17-dev.3 → 6.6.17
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/Migrator.d.ts +1 -0
- package/Migrator.js +11 -0
- package/package.json +4 -4
package/Migrator.d.ts
CHANGED
package/Migrator.js
CHANGED
|
@@ -357,6 +357,11 @@ class Migrator {
|
|
|
357
357
|
}
|
|
358
358
|
if (result.length > 0 && this.options.snapshot) {
|
|
359
359
|
const schema = await knex_1.DatabaseSchema.create(this.em.getConnection(), this.em.getPlatform(), this.config, undefined, undefined, undefined, undefined, ctx);
|
|
360
|
+
// Keep the metadata snapshot when introspection differs only in representation.
|
|
361
|
+
const existing = this.getSchemaFromSnapshot();
|
|
362
|
+
if (existing && !await this.snapshotDiffers(existing, schema)) {
|
|
363
|
+
return result;
|
|
364
|
+
}
|
|
360
365
|
try {
|
|
361
366
|
await this.storeCurrentSchema(schema);
|
|
362
367
|
}
|
|
@@ -366,6 +371,12 @@ class Migrator {
|
|
|
366
371
|
}
|
|
367
372
|
return result;
|
|
368
373
|
}
|
|
374
|
+
async snapshotDiffers(snapshot, schema) {
|
|
375
|
+
const comparator = new knex_1.SchemaComparator(this.driver.getPlatform());
|
|
376
|
+
const diff = comparator.compare(snapshot, schema);
|
|
377
|
+
const sql = await this.schemaGenerator.diffToSQL(diff, { wrap: false, safe: false, dropTables: true });
|
|
378
|
+
return sql.trim().length > 0;
|
|
379
|
+
}
|
|
369
380
|
async runInTransaction(trx, method, options) {
|
|
370
381
|
this.runner.setMasterMigration(trx);
|
|
371
382
|
this.storage.setMasterMigration(trx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/migrations",
|
|
3
|
-
"version": "6.6.17
|
|
3
|
+
"version": "6.6.17",
|
|
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,14 +58,14 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@mikro-orm/knex": "6.6.17
|
|
61
|
+
"@mikro-orm/knex": "6.6.17",
|
|
62
62
|
"fs-extra": "11.3.3",
|
|
63
63
|
"umzug": "3.8.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^6.6.
|
|
66
|
+
"@mikro-orm/core": "^6.6.17"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.
|
|
69
|
+
"@mikro-orm/core": "^6.0.0"
|
|
70
70
|
}
|
|
71
71
|
}
|