This view of Moodle SQL helps to show the relationship between Moodle modules and each module itself in great detail. Marcus Green has updated the diagram for 3.0 using MySQL Workbench, it’s the latest in several versions of the public resource for developers.
A new feature on the ER for 3.0 is the ability to “drill down” to specific modules for greater detail.
Check out Mr. Green’s post here: https://moodle.org/mod/forum/discuss.php?d=278052#p1313423.
Visit his site at http://www.examulator.com/er/ where you can get a MyWorkbench file or PDF to download for your own use.