Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-49795

Add missing Primary/Foreign Key relationships to core Moodle tables

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.8.5
    • Fix Version/s: None
    • Component/s: Database SQL/XMLDB
    • Labels:

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              marcusgreen Marcus Green
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              8 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated: