MySQL Workbench, how to refresh EER diagram

MySQLmysql-workbenchrelational-theory

I'm using MySQL Workbench to design my MySQL database and model how entities would look like and how they would relate to each other. Now, sometimes I use Doctrine ORM. When using Doctrine ORM, I create classes/objects that are domain objects and can be persisted to a database. And through DocBlock Annotations I can express how to relate entities to each other.

With MySQL Workbench I can view an EER Diagram that shows me how objects are related, and by looking at symbols I can see relations clearly. The problem with this approach is that I need to generate database schema using Doctrine CLI. And then in MySQL Workbench I must create an EER model from an existing database. The thing is I change the database schema a lot, and to see the relations in MySQL Workbench I must create an EER model every time. This is time consuming.

Is there a way to just load an EER diagram from an existing database, and then, when the database schema changes, just refresh and see changes, so I don't have to generate the EER diagram for every little change?

I have used Navicat in the past, and there you can do that. When the database changes, just press F5 and relations change immediately in the ER diagram. The only problem with Navicat is there are no symbols between tables that show their relation. Only lines.

Is it possible to have that functionality in MySQL Workbench? If not, are there other tools with which I can see ER diagrams, and that refresh the diagrams as soon as I change the database schema?

Best Answer

From the MySQL Workbench 5.2 window, select Database -> Synchronize model which will allow you to synchronize the model (EER diagram) with the database (you need to create a saved connection) for it.

I recommend this method over just reverse engineering the model from the database since it maintains the layout of the EER diagram. One caveat is that you need to add new tables to the EER diagram manually.