MSBuild SQL database synchronization tasks (for RedGate SqlCompare and SqlDataCompare)
Phil just posted a couple of MSBuild tasks that he uses to synchronize the schema and data of two databases, using the API's for RedGate's SqlCompare (for schema) and SqlDataCompare (for data).
The next project build server I set up I will try these out for size. It would be nice to be able to synchronize the schema from a dev database to a unit testing database, and the data from a unit database to a test database to a production database. The data synch task he wrote would need to be enhanced a bit to be more selective and flexible about the tables to synchronize and how to synch them.
The project I am currently working on has issues with Unit Tests that fail because the data they depend on gets reloaded on the database, or the unit test changes the data and it becomes unrepeatable. I can see this task being useful to have a "clean" unit test database that never gets tests run against it, and using that database as the source to synch the actual unit test database to.
These tasks could help in staging deployments too - by separating the tasks into a "diff" task and a "synch" task - a build process could "compile" the output (ie. SQL script) from the diff of one database to a snapshot of the current production (or test or staging or whatever) environment database, then another task could run a test deployment of that script to the target environement that needs updating. If that is successful, the final production environment deployment should be reproducible from the compiled output.
BTW, these RedGate products, SqlCompare and SqlDataCompare (they have others, but these are the ones I use), THEY ROCK!