My current project is a database for work. To save myself future headaches, I've been sticking to the code it once principle. Specifically, I've been coding table and class information in YAML, then defining templates (using the Template Toolkit, of course) to produce SQL code, Perl modules, and (ta da!) a Makefile.
With lots of Perl glue.
And now I've got the biggest headache of them all.
Moral: trying to save myself headaches later is pointless if my brain explodes in the process!
Update: Happily, the headache is quickly fading. I added a target in my makefile spec to produce a (longish) SQL command file that populates the database in one transaction, and the resulting file is looking good. It's not running to completion, because my data has a few hiccups in it that my data preparation scripts didn't catch, but that's easy enough to fix.
Moral #2: When trying to save yourself headaches later, don't try to save them all at once. One aspirin at a time, my friend!