Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need a .NET database versioning script runner

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

like image 376
Matt Brailsford Avatar asked Dec 23 '09 21:12

Matt Brailsford


1 Answers

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

like image 124
Navid Avatar answered Sep 24 '22 21:09

Navid