MySQL Workbench + propel = useful
This is the first in a series of posts describing the way DiLoc|Rail is built.
As already mentioned i use MySQL Workbench to develop the database schema for DiLoc|Rail. Since I got to know Ruby on Rails some years ago, I was reluctant to write the whole database code for the backend of the app manually, I was in search for something similar. Something which does the hard work, so that i can concentrate on the real problems. Since I did not want the whole package as Ruby on Rails is, the Ruby on Rails clones where no option. So I finally found propel. Propel concentrates on the model in MVC (Model-View-Controller) and is an ORM (Object Relational Mapper) For propel to understand your database, you have to write a schema-file in XML. (There is also an option for reverse engineering the database, but I left that out because it has its own problems). Since I already had a model in MySQL Workbench, I needed a way to convert the workbench file to a propel readable schema.
Over the DBDesigner4 to Propel XSL I got to a version for Workbench by Josh Bryan which was a great start, but it only worked with the alpha versions of workbench. I adapted it to work with the beta versions and also improved it quite a bit, to save even more information to the propel schema. Now it supports:
- all datatypes that MySQL Workbench and propel have in common
- propel required attribute
- propel default values
- autoIncrement attribute
- foreign key relations
- multiple indexes, both primary and unique
Since workbenchs file format is really ugly i was not able to let it work properly if a graphical model is inside the workbench schema. This is due to the weird value/link-tag behaviour mentioned in the last article. I’m playing with the idea of writing a plugin for MySQL Workbench to directly save as propel schema, which should be even easier, but documentation on that matter is sparse at best. - But for now, this solution works satisfyingly.
If anyone is interested, write a comment and ask for the XSL. If many people are interested I would also consider to build a small webservice around it so that you can upload your MySQL Workbench file and get your propel schema for download.
So this was the first part in the series. Next time we will look at how to improve that even more and add some glue to the mix.



Hi there,
that sounds really interesting, I’m missing exactly the same functionality in Workbench to export Propel schemas. Though my favour is Symfony…
Great job.