I thought that previously when I reverse engineered databases, mySql Workbench figured out the relationships from the id names and connected the tables leading to an awesome ERD, even when the foreign key constraint clauses don't exist and they are just used through the fields (xxxx_id) have the foreign key values.
However currently, when I pick various databases (I create them in rails) and try to import them I end up with this nasty looking smodge:
Instead of:
FOREIGN KEY
constraints.survey_sections.survey_header_id
is an FK tosurvey_headers (id)
. And he could be wrong._id
to an FK column. Some useid
, others usetablename_id
, others usetablenameID
, etc... as a PK name. The list is endless. And what about compound PK and FKs? What if the constraint should be towards aUNIQUE
and not towards aPRIMARY
key? How should WOrkbench (or anyone) guess?