Repository navigation
fix: propagate schema and database to closure junction table - #12110
Conversation
Closure tables created for @Tree('closure-table') entities did not
inherit the parent entity's schema or database, causing the junction
table to be created in the wrong schema (e.g. 'public' instead of the
entity's schema). Additionally, TreeRepository queries used tableName
instead of tablePath for innerJoin calls, producing incorrectly quoted
identifiers like "schema.table" instead of "schema"."table".
Closes typeorm#10263
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Review Summary by QodoFix closure table schema and database inheritance
WalkthroughsDescription• Closure junction tables now inherit schema and database from parent entity • TreeRepository queries use tablePath instead of tableName for correct identifier quoting • Added test verifying closure table inherits parent entity schema Diagramflowchart LR
A["Parent Entity<br/>with schema"] -->|"inherits schema<br/>and database"| B["Closure Junction<br/>Table Metadata"]
C["TreeRepository<br/>innerJoin"] -->|"uses tablePath<br/>instead of tableName"| D["Correctly Quoted<br/>Identifiers"]
File Changes1. src/metadata-builder/ClosureJunctionEntityMetadataBuilder.ts
|
|
Hello created the fix and the PR. Used Claude Code but tried to stay as minimal invasive as possible. Reviewed the diffs myself but hope that it will pass by two other reviewers with write access. |
Code Review by Qodo
1. Dotted join string crashes
|
|
I could swear I've seen something like this before. See #10743, specifically this: #10743 (comment) I think a combination of the two PRs would be great to have. CC @gioboa |
commit: |
|
Persistent review updated to latest commit 8032f54 |
|
Persistent review updated to latest commit 4964e0d |
|
|
Persistent review updated to latest commit 0430555 |
Co-authored-by: Navid Nikpour <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]> Co-authored-by: Lucian Mocanu <[email protected]> Co-authored-by: Giorgio Boa <[email protected]>
… the Tree decorator as typeorm#10743 Test locally with multiple database drivers which support the "schema" options Update tests to remove driver-specific assumptions on closure table metadata's tablePath Add functional test case for different schema options provided to the parent Entity and the Tree decorator
… the Tree decorator as typeorm#10743 Test locally with multiple database drivers which support the "schema" options Update tests to remove driver-specific assumptions on closure table metadata's tablePath Add functional test case for different schema options provided to the parent Entity and the Tree decorator
… the Tree decorator as typeorm#10743 Test locally with multiple database drivers which support the "schema" options Update tests to remove driver-specific assumptions on closure table metadata's tablePath Add functional test case for different schema options provided to the parent Entity and the Tree decorator



Summary
schemaanddatabasefrom the parent entity metadata, so they are created in the correct schemaTreeRepositoryqueries now usetablePathinstead oftableNamefor closure table joins, producing correctly quoted identifiers ("schema"."table"instead of"schema.table")Closes #10263
Test plan
test/github-issues/10263verifying closure junction table inherits parent schema🤖 Generated with Claude Code