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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With