Skip to content
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

TreeRepository does not update mpath if parentId was soft-deleted #10843

Open
1 of 18 tasks
JoseCToscano opened this issue Apr 23, 2024 · 0 comments · May be fixed by #10844
Open
1 of 18 tasks

TreeRepository does not update mpath if parentId was soft-deleted #10843

JoseCToscano opened this issue Apr 23, 2024 · 0 comments · May be fixed by #10844

Comments

@JoseCToscano
Copy link
Contributor

JoseCToscano commented Apr 23, 2024

Issue description

mpath is not updated correctly if parentId was soft deleted. Query is unable to "find" parentId even though its path is required to update children's path

Expected Behavior

If Parent "1" has children "2" and "3" (mpaths 1.2 and 1.3), but then Parent "1" is soft deleted and these children are now updated to have parentId = "4" (mpaths 4.2 and 4.3 respectively), their mpath should update correctly from 1.2 and 1.3 to 4.2 and 4.3.

Actual Behavior

Since Parent "1" was soft deleted, the queryBuilder that fetches the mpath from the parent is unable to find it, hence, it is unable to update the childrens' mpath accordingly, leading to a missmatch in the mpath column and the real path

Steps to reproduce

Test scenario will be provided within pull request to solve issue

My Environment

Dependency Version
Operating System
Node.js version 18.19.0
Typescript version x.y.zzz
TypeORM version x.y.zzz

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

JoseCToscano added a commit to JoseCToscano/typeorm that referenced this issue Apr 23, 2024
…pository

Include soft-deleted entities in queryBuilder to fetch required parent's path
even if parent is soft deleted. This path is required to perforn the corresponding
update of the childs' mpath

fix typeorm#10843
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant