@mikro-orm/migrations 7.1.0-dev.20 → 7.1.0-dev.22

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 -1
  2. package/package.json +3 -3
package/Migrator.js CHANGED
@@ -197,9 +197,12 @@ export class Migrator extends AbstractMigrator {
197
197
  const data = fs.readJSONSync(snapshotPath);
198
198
  const schema = new DatabaseSchema(this.driver.getPlatform(), this.config.get('schema'));
199
199
  const { tables, namespaces, ...rest } = data;
200
+ // share schema-level native enums by reference; fall back to per-table copy on older snapshots
201
+ const sharedNativeEnums = rest.nativeEnums ?? {};
202
+ const hasSharedNativeEnums = Object.keys(sharedNativeEnums).length > 0;
200
203
  const tableInstances = tables.map((tbl) => {
201
204
  const table = new DatabaseTable(this.driver.getPlatform(), tbl.name, tbl.schema);
202
- table.nativeEnums = tbl.nativeEnums ?? {};
205
+ table.nativeEnums = hasSharedNativeEnums ? sharedNativeEnums : (tbl.nativeEnums ?? {});
203
206
  table.comment = tbl.comment;
204
207
  if (tbl.indexes) {
205
208
  table.setIndexes(tbl.indexes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/migrations",
3
- "version": "7.1.0-dev.20",
3
+ "version": "7.1.0-dev.22",
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",
@@ -47,13 +47,13 @@
47
47
  "copy": "node ../../scripts/copy.mjs"
48
48
  },
49
49
  "dependencies": {
50
- "@mikro-orm/sql": "7.1.0-dev.20"
50
+ "@mikro-orm/sql": "7.1.0-dev.22"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@mikro-orm/core": "^7.0.12"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.1.0-dev.20"
56
+ "@mikro-orm/core": "7.1.0-dev.22"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"