Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

2 Answers
2

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.

One thing to be careful with 'Database' -> 'Synchronize' is that it defaults to applying the diagram changes to the live database, i.e. it is suggesting statements such as:

DROP TABLE IF EXISTS h2.Import_Homol

Be careful to change this default behaviour if you are just using the EER tool for output diagrams, or your live tables will be dropped if they don't exist in the model (as will additional columns or any other schema changes).