When a new version of Moodle is released I like to create an ER diagram of the database. I do this using some code to extract the SQL statements from the xml files
And then import into MySQLWorkbench which has a "reverse engineer" facility to generate diagrams. These diagrams are dependent on the existence of Primary to Foreign Key relationships and there are places where this works well as can be seen in the Quiz diagram
However there are places where there appears to be missing relationships. I would like these to be added
to core moodle to improve documentation and to make it easier for me to generate diagrams. If referential integrity were ever set to be on it would of course help keep the data sensible but that is another issue.
To start with I have identified missing relationships between the tables course and course_sections and course and course_modules. These could be added to the file
A list of these relationships can be found in the morekeys.xml file at
This issue links with
Which is about turning on referantial integrity for developers