I'm presently using a solution provided by a company called Innovartis (http://www.innovatris.com/) called DBGhost that builds a database much as you would build an application: from source code under version control. These folks have quite an outline for their proposed solution on their web site, and a trial version that helps really grasp it. The key is all the SQL that defines your schema and static data resides in your version control system and is used to build an online database. Thus, it captures changed checked-in and only those changes as a part of the 'final' database for your application.
This particular tool has some nice features including a script generator to get the scripts out of your online database as a start. It also has a comparison piece that helps generate the update script and actually merge changes between different versions. All in all, it allows you to treat your schema more like code than ever before and tag it, branch it and control it.
For now, it's the most control I've had on a database schema in a database application but there are some drawbacks:
- The command line version is way more than the interactive model, which means the automated build of the database is most likely to be reserved for 'special' people or build boxes. I want all my developers to be able to 'build' a database from the command line, but the tool is way to expensive for that.
- The tool is a little clunky on the UI in sort of a wizard format. For us advanced users (and really, if you're building a database doesn't that give you automatic advanced user status?) we should be able to configure it without having to go 'Next' through all the screens.
- The command line version leaves lots to be desired. It's all driven by a single XML configuration file with no opportunity to override even the simplest things (like target server or database) on the command line.
- It doesn't return a normal error code when run from the command line so build tools (like NAnt) don't automatically know when the build has failed. For that matter, how about an NAnt add-in task so we can just pull it all together.
But it works for now, and while we're finding glitches now and then it's great to automatically generate a database create script and update script every night in our nightly build with no manual intervention directly from version control. Feel the warm and fuzzies...