1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

The history

In December I’ve got a project, that required sophisticated and quite complex DB and that DB was subject to change greatly during first development phase. Before that project I was using Sparx Enterprise Architect both for application design and DB design. But, frankly speaking, it’s not good at databases, especially MySQL. So I decided to pick up a new DB modelling tool.

Requirements

My requirements to it were:

  • Convenient entering of the attributes and their types. When I have an idea, I want it to be recorded fast, I don’t want to spend time clicking different “add” and “save” buttons in order to enter table attributes
  • Full MySQL features (including all types of indexes) and main storage engines support (MyISAM, InnoDB, MEMORY)
  • Visual tables layout like in MS Access
  • Maintaining table joins and involved indexes, visual creation of table connections
  • SQL export
  • Free!

On the way to perfection…

I went through this list and installed and tried around 10 different tools and I didn’t like any of them. One has no visual modelling, other has inconvenient input, third has both, but doesn’t support a number of MySQL features. So finally I ended up with MySQL Workbench. It gives me all I need and even more.

Yes! It’s really perfect :)

Here you may find a list of features together with versions comparison. You can read it yourself and I want to describe why I liked it:

Nice design

Yes, it matters. When you use Windows95-like program, you can’t feel as good as if you’re using excellent-designed one. Here is a screen:

Model Overview

Model Overview

Creating DB

I liked their “schema approach”. When you create DB, you set the schema default encoding and all the tables in DB are automatically created in this encoding. Sure, you can change it for each table, but this is very helpful. I’ve also set up mydefault storage engine – InnoDB (MyISAM is default). This setting can be found in a seconds; everything is in it’s place (Tools -> Options -> MySQL).
So now I can create my table without remembering that I should change some settings each time I create new table. That’s my first requirement.

Creating tables

I liked their template approach to the generic field names. Near every table has ID field. In my name conventions (since I’m using Yii framework, I follow their), ID field name is [tableName]ID. So I go to the Tools -> Options -> Model and set there:

  • Primary key pattern – %table%ID
  • Primary key default type – INT(11)
  • Foreign key defaults (since I’m using InnoDB, which takes care of data integrity, I set this. I’ll tell more about this in my future posts about MySQL&InnoDB)

Three little settings, but it makes my life much more simple! Actually, you can set up the naming of the auto-generated index fields, but I don’t use it, I create all tables I need myself. However, Workbench can create cross table for Many-to-Many relation for you.
Now I create the table (collation and engine are set automatically), go to the “fields” tab (tabs are in the bottom – I had problems finding them first time) and have my ID field created. Unfortunately, I can’t say that I want first letter in lower-case, so I correct it manually. Then start adding fields. It is very simple. First you double click on the empty row where should one name of the field, enter your name, press TAB, enter the field type (I usually enter 1-3 letters and press “Down” key, it selects correct type), press TAB again and you’re on the next field! So you just keep populating your attributes really fast! Then just tick NN (not null) and AI (auto increment) checkboxes and your table scheme is done. All indexes are set up on the next tab – Indexes except PRIMARY KEY. ID field is PRIMARY KEY by default. To add more fields there, select field and tick PRIMARY KEY checkbox in the right part of the tab.

Visual layout

Consider we created tables we need, now we advance to the scheme and connections. Double click “Add Diagram” in the top of the screen and you’re there. In the centre of the right pane you have tables you created. If you drag table from that list to your diagram, you’ll see big dot near it’s name. That’s also very convenient when you have a number of tables. Sure, here you can snap to grid, show/hide it, but that’s not so impressive.

Visual grouping

And this feature is mega-great! When you have huge DB, you can group tables using coloured layers:

ER Diagram with coloured layers for grouping

ER Diagram with coloured layers for grouping

Visual connections

Yes, it allows you to connect tables like you want. 1-1,1-N and N-M relations. If you prefer to create foreign keys automatically, yo can use these types of joins. I prefer to create all tables and fields and then connect it. So I click on the last icon in the left toolbar, select foreign key, then click “Pick referenced columns” and finally select the primary key I link to. I’m done. All InnoDB connections are automatically created.

Creating relationship using existing columns

Creating relationship using existing columns

SQL export

Sure, SQL export is not new or impressive feature, but MySQL Workbench allows you not only to create SQL for the scheme, but also to create ALTER DB script for the CREATE DB script already created. For example, you designed a great DB, exported to SQL query, installed on server and then your client wants changes. You open MySQL Workbench project, make necessary changes and then create ALTER script. Very convenient thing :)

Integration with Yii

One clever guy (unikly) created the Yii shell command, that allows to use mwb file instead of DB connection when creating Yii DB models. This command is available on the Yii extensions page. As for me, it’s a very big plus.

A fly in the ointment

I’ve noticed several bad things in this software:

  • When DB becomes huge, you need a good machine to work with it comfortably. It takes too much resources
  • Some interface elements are not evident (In the DB overview screen lowest part has tabs both on the top and on the bottom. Top tabs – switch between tables, bottom tabs – switch between table’s sections (properties, fields, indexes)
  • When creating joins, it doesn’t maintain the uniqueness of foreign indexes names. Take a close look at the export script (and watch for constraints and auto-created foreign keys) when it fails in phpMyAdmin (or other tool)

Disclaimer: Screenshots are taken from MySQL Workbench site, I was lazy to take my own ones.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Share this post with a friend Share this post with a friend

14 Comments

  1. Will says:

    Great post, totally agree!!!
    One more reason to choose Yii!

  2. Konstantin Mirin says:

    Yeah, I like that program. Very handy to use and it’s import-export features are really excellent.
    I’m going to try that in the nearest time and will publish my results :)

  3. Ing.espitaleta says:

    I have a question, is this dabase designer better than dbdesigner 4.0 or fork from this one???, I mean I would like to try this new one, but I want to be sure by should I use this one!!
    Best regards!

  4. Konstantin Mirin says:

    Here, on the download page: http://fabforce.net/downloads.php you can see the latest release is mysql workbench. And description states: “DBDesigner4 successor, recommended for all DBD4 users”. So I think it should be better. However, I think, that MySQL development team made some features available only in commercial version. If you try it, could you write your feedback on this?

  5. pestaa says:

    I also use Workbench daily, however, it is terribly slow.

  6. Konstantin Mirin says:

    Yes, I wish it worked faster. However it is very handy and it suits me. By the way, not only this app is slow on my pc, so maybe we should update hardware?

  7. Database Designer says:

    Very nice Article – Is it OK if i place a Link on my Domain http://www.dbdesigner4.de/ to this?

  8. Konstantin Mirin says:

    Sure! Feel free to link to my posts, just don’t copy them without permission :)

  9. pintu says:

    Nice 1!……..

    Keep Rocking…

  10. Elif says:

    Well.. My two cents: The features listed on page http://www.mysql.com/products/workbench/features.html under the Community Edition are misleading. I can’t find any explanation why they can not update their website, if they shifted some of that functionality to the commercial version. In my opinion, it is mis-advertising..

  11. Osvaldo Nevin says:

    To start earning money with your blog, initially use Google Adsense but gradually as your traffic increases, keep adding more and more money making programs to your site.

  12. Pregnancy massage Ashburton says:

    wow. i think your blog is great. i like the layout, clours and patterns. ill implement the same on my site. what theme do you use?

  13. ps4 sony says:

    this post in indeed a very informative one. ill refer my friends and get this bookmarked as well
    thumbs up
    regards
    :D

  14. » MySQL Workbench Reference » Programming Dashboard Programming Dashboard says:

    [...] MySQL Workbench (Visual Table Layouts – and discussion about Yii) [...]

Leave a Reply