Skip to content

Instantly share code, notes, and snippets.

@yleflour
Created August 7, 2020 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yleflour/0bda286aef0b80c16000ae7c93107178 to your computer and use it in GitHub Desktop.
Save yleflour/0bda286aef0b80c16000ae7c93107178 to your computer and use it in GitHub Desktop.
Fix for https://github.com/typeorm/typeorm/issues/3938 to be used with patch-package
diff --git a/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js b/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js
index 43fb09e..b62e654 100644
--- a/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js
+++ b/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js
@@ -145,10 +145,11 @@ var OneToManySubjectBuilder = /** @class */ (function () {
parentSubject: subject,
canBeUpdated: true,
identifier: removedRelatedEntityRelationId,
- changeMaps: [{
- relation: relation.inverseRelation,
- value: null
- }]
+ mustBeRemoved: !relation.inverseRelation.isNullable ? true : undefined,
+ changeMaps: relation.inverseRelation.isNullable ? [{
+ relation: relation.inverseRelation,
+ value: null
+ }] : undefined,
});
_this.subjects.push(removedRelatedEntitySubject);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment