[bra_highlight style=”highlight2″]In this Post we will learn about reverse engineering with MySQL Workbench on top of an existing MySQL database schema. This is the second part of an ongoing series for using MySQL Workbench to manage databases. Part 1 Setting Up MySQL Workbench [/bra_highlight]
What is database schema
Have you wanted look to see how tables in a database relate to each other or had to update a project with an existing database and no documentation? Well in this second part of our tutorials on MySQL Workbench we are going to create documentation from an existing WordPress database. This documentation will be called an EER (Enhanced Entity Relationship) Diagram but we can just refer to it as our database schema. MySQL Workbench has a wizard that will help us get started with creating this documentation.
Begin Modeling
- First we will open up our MySQL Workbench and click on the Create EER Model From Existing Database
- We will use the connection we already have stored in MySQL Workbench (Lesson 1)
- As we are going through the steps in the Wizard be sure to select only the database we want to Reverse Engineer my example is test
- Go through the rest of the Wizard with the default values selected and you should see a screen that looks like this
- Now we have to go through and move our tables so we can see them all Select -> Arrange -> Autolayout (pretty awesome isn’t it)
- Congratulation we now have an EER Diagram (without relationships we will have to manual add those)
Conclusion
We have just created our own EER for an existing database which counts toward documentation for our project. This process is very simple but powerful tool in MySQL Workbench. Once we set up the EER we can also use it to forward engineer. Try adding a new column or table to the EER then save changes and verify the changes in from the SQL editor window.