Question

I'm looking at versioning databases and came across the usual articles regarding how to do this (coding horror, ode to code, etc). This all make perfect sense to me, however I'm trying to find a script runner that will run the sql scripts for me. All these articles mention having something to run them automatically, but none of them make any recommendations.

Does anybody know of any utilities for running these scripts? Ideally something that works in the following way:

  1. Runs everything in a transaction so if any single update fails, the whole thing fails
  2. I have control over the name of the scheme version database table
  3. Ability to have a series of scripts that are always run if an upgrade takes place
  4. Can be run as part of an automated task

    EDIT

  5. Open Source

Was it helpful?

Solution

Check out SSW SQL Deploy - it would appear to do just about all you're asking for. It keeps track of already executed scripts, it'll run a whole batch of scripts at once and on multiple servers (if required), and so forth.

alt text

It's a pretty simple, but nifty tool - highly recommended!

OTHER TIPS

We Use DbUp as Script Runner in our Web Project. Its simple and nice open source tools that help you to write you own script runner with Console Application fashion.

DbUp is a .NET library that helps you to deploy changes to SQL Server databases. It tracks which SQL scripts have been run already, and runs the change scripts that are needed to get your database up to date.

we can run scripts from folder in filesystem or you can embed them to your assembly and run them as embedded scripts.

you can find more information and sample on their code repository on github.

http://dbup.github.com

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top