Skip to content

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

Closed

Description

@JoseCToscano

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.

Activity

  1. added a commit that references this issue on Apr 23, 2024
    fdbe3fc
  2. github-actions commented on Sep 18, 2025

    @github-actions

    TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).

    As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.

    🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
    If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions