-
Improvement
-
Resolution: Fixed
-
Minor
-
2.8.5, 4.0
-
MOODLE_28_STABLE, MOODLE_400_STABLE
-
MOODLE_401_STABLE
-
MDL-49795-add-missing-keys-indexes-to-core-tables -
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
https://github.com/marcusgreen/moodle_local-sqlgenerator
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
http://www.examulator.com/er/components/quiz.png
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
lib\db\install.xml
A list of these relationships can be found in the morekeys.xml file at
https://github.com/marcusgreen/moodle_local-sqlgenerator
This issue links with
https://tracker.moodle.org/browse/MDL-30799
Which is about turning on referantial integrity for developers
- has a non-specific relationship to
-
MDL-30799 META: Enable foreign keys in the database schema
- Open
- has been marked as being related by
-
MDL-78180 Missing logstore_standard_log table after upgrading Moodle
- Closed
- is duplicated by
-
MDL-75591 Performance boost for data delete request inside the cron
- Closed
- will help resolve
-
MDL-71793 Extend check_database_schema to look for potentially missing foreign relations
- Development in progress