@mikro-orm/core 6.6.1-dev.1 → 6.6.1-dev.2

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": "6.6.1-dev.1",
3
+ "version": "6.6.1-dev.2",
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",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.3.2",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.6.1-dev.1",
67
+ "mikro-orm": "6.6.1-dev.2",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -291,11 +291,22 @@ class ChangeSetPersister {
291
291
  async reloadVersionValues(meta, changeSets, options) {
292
292
  const reloadProps = meta.versionProperty && !this.usesReturningStatement ? [meta.properties[meta.versionProperty]] : [];
293
293
  if (changeSets[0].type === ChangeSet_1.ChangeSetType.CREATE) {
294
- // do not reload things that already had a runtime value
295
- meta.props
296
- .filter(prop => prop.persist !== false && (prop.autoincrement || prop.generated || prop.defaultRaw))
297
- .filter(prop => (changeSets[0].entity[prop.name] == null && prop.defaultRaw !== 'null') || utils_1.Utils.isRawSql(changeSets[0].entity[prop.name]))
298
- .forEach(prop => reloadProps.push(prop));
294
+ for (const prop of meta.props) {
295
+ if (prop.persist === false) {
296
+ continue;
297
+ }
298
+ if (utils_1.Utils.isRawSql(changeSets[0].entity[prop.name])) {
299
+ reloadProps.push(prop);
300
+ continue;
301
+ }
302
+ // do not reload things that already had a runtime value
303
+ if (changeSets[0].entity[prop.name] != null || prop.defaultRaw === 'null') {
304
+ continue;
305
+ }
306
+ if (prop.autoincrement || prop.generated || prop.defaultRaw) {
307
+ reloadProps.push(prop);
308
+ }
309
+ }
299
310
  }
300
311
  if (changeSets[0].type === ChangeSet_1.ChangeSetType.UPDATE) {
301
312
  const returning = new Set();