Add support for derived relations in XMLDB and remove obsolete relations file - #31
Add support for derived relations in XMLDB and remove obsolete relations file#31harshil8595 wants to merge 2 commits into
Conversation
|
Hi @grabs I understand you may be busy, but I would really appreciate it if you could take a look when you have some time. Please let me know if any changes or additional information are needed from my side. I’d be happy to update the PR accordingly. Thank you for your time and for maintaining this project. |
|
Hello, thank you very much for this useful addition! |
|
Hi @grabs , Thanks for your time and efforts. |
|
Hi @grabs, Can you add me as contributor in this plugin on moodle.org? I've messaged you my moodle userid to your moodle account. It will be grealy appreciated |
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.