Create DB Logical & Physical diagrams

0 votes
asked Jan 19 in Question / help by Chippyash

I use PlantUML a lot in sketching out initial designs for systems etc. I kind of hacked together diagrams for database design until recently I needed something  a bit more robust, so tackled it head on. The results is .

I'm currently working on a utility to convert the physical diagram into DDL to create the database schema.

Is this of interest to others?

I'd appreciate feedback on what is done so far.

commented Jan 23 by zimchaa (1,020 points)

I think this is really interesting - I wondered the same myself, i.e. can I turn a sufficiently correctly formatted PlantUML diagram into a SQL representation of the same thing. I also wondered if it was a 2 way thing, e.g.

  1. Get a DDL
  2. Convert to a diagram (i.e. SQL to PlantUML)
  3. View / edit diagram as required
  4. Convert to DDL (i.e. PlantUML to SQL - as you have already)
  5. Update database
  6. Profit (lol)
I'll be following your project - thanks
commented Jan 23 by Chippyash
The generation of the DDL from the diagram is relatively trivial, as PlantUml offers numerous ways to convert from internal to an external format. My converter uses the XMI (XML) format to generate something that is then translated into a PHP data structure via an XSLT translation and finally passed through a renderer in PHP that generates the DDL. This pattern allows the creation of different renderers to target different DDL syntax. (Next on list for me will be SqlLite.)

It's maybe possible to reverse the process by dumping the DB in xml format (mysql --xml), then using that as a source to create a PUML file, but I haven't investigated.

However, what you probably want to do in your scenario, is edit the ingested schema, then create a new database from it followed by a diff to generate an update file that can be run against the original DB to make the change.  In which case, simply amending your original drawing (assuming you have one) would suffice.

I'd be happy for someone to add to the repo to do the reverse engineering bit!  Or indeed, redo the existing converter as a Java Jar on the basis that not all users will have / want to have PHP on their system, but by virtue of using PlantUml, they already have Java installed.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.