Add support for derived relations in XMLDB and remove obsolete relations file#31
Open
harshil8595 wants to merge 1 commit intograbs:mainfrom
Open
Add support for derived relations in XMLDB and remove obsolete relations file#31harshil8595 wants to merge 1 commit intograbs:mainfrom
harshil8595 wants to merge 1 commit intograbs:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @grabs
I can't reopen existing PR
Add foreign key links support for component tables following
componentname_objectpatternAfter the addition of foreign links support, I tested the feature with Moodle plugins tables and noticed an edge case related to tables belonging to components.
Currently, object table relations are automatically populated when column names match the pattern
{object}idand a corresponding{object}table exists. For example, columns namedcourseidcorrectly link to thecoursetable.However, Moodle plugin tables follow a different naming convention:
For example:
tool_customlangtool_customlang_componentscomponentidtool_customlang.componentid→tool_customlang_components.idThis relation is defined in Moodle’s install.xml:
But currently, Adminer does not automatically generate links for such component-based tables.
Steps to reproduce
Visit
{yourmoodle}/admin/tool/customlang/index.phpSelect a language
Click
Open language pack for editing
Open table in adminer
tool_customlangObserve field
componentidExpected result:
componentidshould display links to records intool_customlang_componentsActual result:
No relation link is shown
Proposed improvement
This PR extends the foreign link detection logic to support Moodle plugin table naming conventions:
This ensures relations such as:
are correctly detected and linked.
Benefits
This significantly improves debugging and developer productivity by allowing Moodle developers to:
This is especially useful because Moodle defines logical foreign keys in XML but does not enforce them at the database level.
I am happy to make further improvements or adjustments based on your feedback.