typeorm / typeorm

ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
http://typeorm.io
MIT License
34.28k stars 6.32k forks source link

Closure table should allow for multiple tree parents #11127

Open Nosfistis opened 1 week ago

Nosfistis commented 1 week ago

Feature Description

Closure table is a tree hierarchy structure that allows for multiple parents. However, TypeORM's current structure only allows for a single parent. Missing this closure-table feature makes this approach lose one of its main benefits.

The Solution

A new decorator should be introduced for tree structures like closure-table, to avoid confusion with single-parent approaches. Else, the current TreeParent should be changed to support arrays. I understand that this might also include more changes in the ways tree structures are currently handled.

Considered Alternatives

I do not think that there is any other way of dealing with this right now, other than using subscribers/listeners and custom logic.

Additional Context

No response

Relevant Database Driver(s)

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

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

circular-gyr commented 10 hours ago

I need this!!!

Guiladg commented 10 hours ago

Is not possible at all to have multiple parents in a tree by now?

Nosfistis commented 10 hours ago

It seems not. I have tried it on a test project and there is no way you can assign child.parent = [].