Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database Change Management using hand generated scripts [closed]

My need is fairly basic and I don't want to rebuild the wheel. I like to script my database and have written scripts to update it from one version to the next ie 001-create-tables.sql, 002-alter-column.sql etc.

What I want is a simple tool command line or MsBuild that will look at a database see what version the database is at (using some table convention) and run all of the scripts in a folder that have a higher number than the current database version. I would also like the tool to roll back a script if it fails/throws an error and stop at that point.

That is what I would like but I don't mind changing my conventions though I do want to write my own sql scripts. I also want the tool to be free or open source as I don't need too much. As my projects are C# I would prefer the tool be built in .Net

like image 833
runxc1 Bret Ferrier Avatar asked Nov 12 '09 16:11

runxc1 Bret Ferrier


People also ask

How do I create a SQL script database?

In SQL Server Management Studio, expand Databases, and then locate the database that you want to script. Right-click the database, point to Script Database As, point to CREATE to, and then click File. Enter a file name, and then click Save. The core database container will be scripted.


1 Answers

Have you looked at Open DBDiff yet? It may be a good place to start.

if you change your mind about open source, Red Gate's SQL Compare is the way to go IMO.

like image 115
Galwegian Avatar answered Sep 29 '22 10:09

Galwegian