Moodle Database - Reverse Engineering ERD

31 views Asked by At

I want to create an ERD for my moodle database. Which tools do you recommend? How can I force Moodle to create the foreign keys?

Thanks in advance

I tried DBeaver. There are no relations displayed between the tables. Moodle does not create any foreign keys by default.

1

There are 1 answers

0
Matt Rice On

There are semi-official schema diagrams available from Moodle's developer documentation, although I personally don't care for the viewer for the chosen file format (DBDesigner4).

If you want to create your own ERD, MDL-49795 has some tips, namely:

Standard Moodle will not even install let alone work if the PK/FK relationships are actually implemented. I regularly (yearly?) do create a Moodle database from a custom SQL script that has the PK/FK relationships enabled by adding this to the start of the DDL sql for MySQL to

SET FOREIGN_KEY_CHECKS=0;

That enables the database creation but it would break if you try to actually run Moodle with it.