fix(ModuleInstallerAPI): Rename class in DB recursively#854
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes ModuleInstallerAPI::RenameClassInDB() so class renames are reflected in the DB for inheritance chains that include intermediate classes, preventing objects from “disappearing” from queries due to stale finalclass values.
Changes:
- Replace single-root-table update with an iteration over all parent classes of the target class to update
finalclassconsistently across the inheritance chain. - Accumulate affected rows across all executed updates for logging.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Probably it could also rename the |
|
And the |
|
PR review: @Hipska we are ok to include this in the upcoming 3.4.0, but only if you add unit tests covering your changes until then. |
|
Great to hear. Could you help thinking of a scenario I could implement in a test? |
|
@rquetiez any idea? You know the unit test APIs best. |
Base information
Symptom
Using
ModuleInstallerAPI::RenameClassInDBto rename classes does not work for classes having intermediate classes.Renaming
Childworks:ParentChildRenaming
Childdoes not work:ParentIntermediateChildReproduction procedure
DBserver.ModuleInstallerAPI::RenameClassInDB('DBserver', 'DBServer');as done initop-config-mgmt.SELECT SoftwareInstanceObserve the DB server objects not being listed (but they are counted in total objects).
Cause
The mentioned helper method only updates the finalclass field for the root class.
Proposed solution
Update the finalclass field for all parent classes recursively.
Checklist before requesting a review