I'm looking for a way to automated the generation of change scripts for our databases.
Currently we use Visual Studio 2008 database edition, which has the Schema Compare option, but I don't see a way to automated those actions.
What I'd like to do is create an old and a new database during my daily builds and have schema compare generate a change script for the differences between those two. (Differences in schema and procedures, lookup tables can be dropped and recreated without problems)
Does anyone know of a solution for, or am I going to write miles of scripts to get this going?
Using any paid products besides the Microsoft tooling is not an option here...
Update based on feedback:
SQL queries are very powerful by themselves, but by automating queries as part of your data flow, you will unlock tons of potential in your data. In this use case, we will explore using the SQL Runner App to automate, insert and update queries.
Using the Generate and Publish Scripts Wizard. In Object Explorer, expand the node for the instance containing the database to be scripted. Point to Tasks, and then select Generate Scripts.
SQL Change Automation generates numerically ordered SQL migration scripts that sit inside your Visual Studio project and take your schema from one version to the next. You can add these migration scripts to version control, use them to build and release, and automate database deployments, all in one process.
Similar to what @Anton Gogolev is doing, we are using a tool that allows you to write migrations in XML files. The tool we use is called Liquibase and it supports many different DBMS flavors. Not only do we use it internally on our developer schemas, we also use it externally during the upgrade installation that the customer runs.
Hope I can still help:
You should be able to do this with any good database comparison tool that supports command line interface. In that case you would have to create a simple bat script and add it to task scheduler.
I know ApexSQL Diff supports this functionality and I’m pretty sure SQL Compare from Red Gate has the same option in pro version.
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