Repository navigation
fix(tree-entity): tree entity schema propagation in internal TreeRepository methods - #12590
Conversation
|
Extended test coverage to additional database drivers that support "schema" configuration.
The following drivers have been validated locally:
There is some intentional overlap in the test coverage, as TreeRepository behavior is exercised across entities with different schema configurations. This is primarily to ensure regression safety around schema-qualified closure tables and query builder aliasing behavior, at the cost of a slightly increased test runtime. All tests are currently passing locally, no regressions have been observed relative to issue #10263, and it fixes the issue I reported in #12588 . The core fix has been validated against the main drivers with schema support available in my setup (PostgreSQL, CockroachDB, MSSQL, Google Spanner). Oracle and SAP HANA were not included due to local/environmental constraints rather than any known incompatibility in the implementation. If there are established CI patterns or infrastructure for improving coverage on those drivers, I’d be happy to align with them in a follow-up PR. Otherwise, I consider the regression addressed and this change safe to merge. Thank you for reviewing. |
a0c5b5d to
a1dee05
Compare
Code Review by Qodo
1. Schema test type mismatch
|
Code Review by Qodo
1. descandantColumnName typo in docs
|
commit: |
Change introduced by MR !12110 breaks TreeRepository find methods whenever schema is specified in the dataSource options Step 1: Rewriting of closure metadata tests from issue 10263 to monitor regressions
… 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
Promise in test was not correctly returned to test runner and may have caused a test hang. Test now uses constructed table path in metadata to check for existance rather than attempting to re-create it. fix docs typo.
… identity? As soon as we pass a dotted string to innerJoin it's ambiguous and it resurfaces typeorm#12588. Passing the target trivializes the metadata lookup and still seems to work fine (all tests passing)
cfb7a70 to
818198e
Compare
while retaining sufficient typing on the class constructor passed as argument
|
If I'm not missing anything, I believe I've now addressed all review comments raised by Qodo, rebased the branch onto the latest commits on main, and run linting on all modified files. The fix has been validated against the schema-supporting drivers available in my environment, all tests are passing locally, and I haven't observed any regressions relative to the reported issue. When convenient, I'd appreciate another review from the maintainers to confirm that the implementation and test coverage are in good shape for merge. Thank you for your time and feedback. |
|
Thanks for the contribution @xEverth! I also backported it to v0, so it should be available soon on both major versions. |
|
Thanks for the quick review and for backporting it to v0 as well. I'm glad I could help, and I appreciate how quickly you got this addressed! |
Description of change
This PR addresses a regression introduced in 0.3.29 affecting internal TreeRepository methods that use QueryBuilder when using a global schema configuration (DataSourceOptions.schema) or schema-qualified entities.
The PR includes working reproduction for the issue (checkout 94c1a97 ) and updates to entity metadata and functional tests for tree-entities using closure-table.
The applied resolution consists in adding option
closureTableSchematoClosureTreeOptionsand giving it priority over the schema defined on the tree parent Entity or the dataSource's (similar approach to @andimattes 's #10743, addresses comments by maintainers). Should also address possible naming collisions (same closure table name, different schemas) by passing this.metadata.closureJunctionTable.target to queryBuilder's innerJoin's first argument.It:
Fixes #12588
Fixes #10263
Pull-Request Checklist
masterbranchFixes #NNNN,Closes #NNNN, orResolves #NNNNtests/**.test.ts)docs/docs/**.md)