Tutorials‎ > ‎

MySQL workbench




MySQL Workbench


Mysql workbench is used to schema management, you ccan design , redesign and update your schema using this. Better, we can do forward and reverse engineering through this tool.

mycp uses this tool so that  the schema is updated directly in the database and this design tool. one the DB is updated, we use spring roo to do RAD.


Download or use mysql-workbench-gpl-5.2.43-win32 from http://dev.mysql.com/downloads/workbench/1.0.html

You also need to install the dependents of workbench  

    1. dotNetFx40_Client_setup.exe from http://www.microsoft.com/en-us/download/details.aspx?id=17113
    2. vcredist_x86.exe from http://www.microsoft.com/en-us/download/details.aspx?id=5555




Create a test ER  diagram



Click export à forwar engineer CREATE script



Start filling out the details and the page flow to create tables in the database.

Make sure you give a name to the sql file and save it . this will help in future when you want to generate alter table scrips.


After next ,


Make sure you save the file… this will be your first initial state of the database.

OR

clicking finish will create the file which was earlier specified.

Update or alter the schema

Now if you want to change some fields in the database, you can generate a alter script with the difference and execute that.



Change the from_date to from_d and till_date to till_d


Click on export à forward engineer SQl ALTER script

Select the first sql file which you created and then give a new name to the alter script and click next


Notice that it got the difference in sql files,

Now save this file somewhere else and click on execute.

This should update the database. If not , execute the SQLs directly onto the database.


After this , take a snapshot of the current latest version of your database by doing a “create a forward engineering script” and saving it as your latest version.next time you change something , you will need this to compare and get the diff of sql files for alter script.



After the process make sure you have the the tables created in DB


Comments