@mikro-orm/core 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.
@@ -222,7 +222,8 @@ class EntityHelper {
222
222
  // Inverse already points to owner — propagation is not needed,
223
223
  // but we still need to clean up old's inverse side.
224
224
  (0, wrap_1.helper)(old).__pk ??= (0, wrap_1.helper)(old).getPrimaryKey();
225
- if (old[prop2.name] != null) {
225
+ // Don't nullify the FK if it's part of the PK — the entity will be deleted via orphan removal
226
+ if (old[prop2.name] != null && !(prop.orphanRemoval && prop2.primary)) {
226
227
  delete (0, wrap_1.helper)(old).__data[prop2.name];
227
228
  old[prop2.name] = null;
228
229
  }
@@ -258,7 +259,8 @@ class EntityHelper {
258
259
  else {
259
260
  entity[prop2.name] = Reference_1.Reference.wrapReference(owner, prop);
260
261
  }
261
- if (old?.[prop2.name] != null) {
262
+ // Don't nullify the FK if it's part of the PK — the entity will be deleted via orphan removal
263
+ if (old?.[prop2.name] != null && !(prop.orphanRemoval && prop2.primary)) {
262
264
  delete (0, wrap_1.helper)(old).__data[prop2.name];
263
265
  old[prop2.name] = null;
264
266
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
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",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.3.3",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.6.11",
67
+ "mikro-orm": "6.6.12-dev.1",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }