Nick Jones

a magento developer at Meanbee (@nickj89) and uk magento expert based in Bath

Magento ERD (Attempt) with MySQL Workbench

I’m working on a new project for Meanbee and decided that it would be best to take a more formal approach to the design of the database now that I am working more closely with Tom.

Magento 1.3.1.1 Entity Relationship DiagramThe tool I am using at the moment is MySQL Workbench 5.1 beta. The stability is not that great on Ubuntu, its a beta release for Linux and Mac after all. I get a crash every now and again, especially whenever I try to set a column to auto increment. Anyway, I decided it would be nice to try and get an up to date look at an ERD for Magento. Workbench has a pretty cool “reverse engineer” tool which builds you a nice diagram from schemata.

Adding all the Tables to the Diagram
The first problem was actually getting all of the tables onto the diagram. The way it works is that you first create the diagram, then you click and drag all of the tables from the “catalog” on the right hand side to the diagram in the middle. Turns out you can’t do more than one at a time this way, so if anyone is googling “mysql workbench add all tables” or something right now, I hope you find this post. Whilst in the “MySQL Model” view (the one that shows your list of diagrams at the top, the tables underneath, then the views, routines, etc, select all of your tables by hold down shift and using your arrow keys). Drag the selected tables up to your open diagram tab at the top of the screen, hover for a while until the tab opens, then drop onto the diagram. That’ll do it.

The Result
The thumbnail give you a hint at the quality of the result. Workbench has an “auto layout” feature which attempts to automatically place the tables in good positions around the diagram to make the interpretation that little bit easier. It didn’t do so well with Magento and it’s 229 tables. Some big improvements needed there.

3 Responses to Magento ERD (Attempt) with MySQL Workbench

  1. there is a nice db schema diagram knocking around the Magento forum which might be a bit more useful

  2. That would be a very interesting way to select all tables, but I'm quite sure you meant to write "hold down SHIFT"… you may want to double-check to see what you actually ended up with. ;) Also, I think you forgot to close your parentheses. (Just a little friendly proof-reading, free of cost.)

    And thanks, of course, for sharing your Magento-related findings on your blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">