-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect insert order when cascade inserting parent inherited relations #9241
Labels
Comments
7 tasks
pleerock
pushed a commit
that referenced
this issue
Aug 24, 2022
Take inheritance into consideration when sorting insert commands Closes: #9241 Co-authored-by: Kevin KONRAD <ext.kevin.konrad@reseau.sncf.fr>
wirekang
pushed a commit
to wirekang/typeorm
that referenced
this issue
Aug 25, 2022
Take inheritance into consideration when sorting insert commands Closes: typeorm#9241 Co-authored-by: Kevin KONRAD <ext.kevin.konrad@reseau.sncf.fr>
7 tasks
pleerock
pushed a commit
that referenced
this issue
Aug 25, 2022
nordinh
pushed a commit
to nordinh/typeorm
that referenced
this issue
Aug 29, 2022
Take inheritance into consideration when sorting insert commands Closes: typeorm#9241 Co-authored-by: Kevin KONRAD <ext.kevin.konrad@reseau.sncf.fr>
nordinh
pushed a commit
to nordinh/typeorm
that referenced
this issue
Aug 29, 2022
Fix forgot comparison operator in typeorm#9242 Closes: typeorm#9241 Co-authored-by: Kevin KONRAD <ext.kevin.konrad@reseau.sncf.fr>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue Description
Expected Behavior
When I insert a child entity with nested relations inherited from a parent, I want the child entity to be inserted prior to the relations in order not to break not null constraints on the foreign keys
Actual Behavior
When I insert a child entity with nested relations inherited from a parent, the relations are inserted before the child entity with NULL value as a foreign key and then are updated with the correct foreign key once the entity has been inserted
Thus, we cannot use this foreign key as part of a composite primary key as it must stay nullable so that the transaction does not break
Steps to Reproduce
Are you willing to resolve this issue by submitting a Pull Request?
The problem is located in src/persistence/SubjectTopoligicalSorter.ts which does not check the entity parent type to sort the insert commands
Related PR: #9242
The text was updated successfully, but these errors were encountered: