The database schemas for my current project are getting hashed out, mostly in Visio. This is pretty but not very automatable. I’d like to see if we can follow a more agile, iterative approach to database development. In particular, I’d like to be able to check the database definition into source code control and build the whole thing, including database tables and sample databases for testing out of Ant. Requirements include:
Supports (at a minimum) MySQL and Derby
Can be read by Java and Python
Allows for inserting of data for unit testing; i.e. not just table definitions
It also wouldn’t hurt if it could reverse engineer existing SQL databases.
I’m tempted to write my own, probably using XML, but surely someone has already done this? I haven’t found a lot though. What I’ve got so far are these, none of which really meet the requirements:
Andromeda
Andromeda uses YAML for the database definition language. The downside is that only a PHP parser is currently available. I’d have to write one for Java and/or Python.
Python
We have some database generation code written in Python. Maybe I should just use Jython to call this from Java? It still feels like a hack though.
Raw SQL
We could just write a big SQL script to set up the tables and load in the data. However JDBC can’t execute SQL scripts, only individual statements. (Perhaps this is fixed somewhere in some project?)
Surely this is an obvious enough idea that someone has already done it? Probably in XML? Any ideas?