Exclude baseline for sqlcmd script
Hi,
When creating a sqlcmd file, is it posible to only include migrations afther a specific version. E.g. the baseline.
We have about 10mb of baseline scripts (excl most data) and updating a database takes a lot of time, because all the baseline scripts get executed on every database. This is good when creating a new database and is fast enough when you are updating 1 database, but on 500 databases, 10s means 10*500 seconds ~ 83min of checking if statements. We could manually delete Parts of the script, but manual script work is the reason we are now using readyroll...
Fyi: I don't mind a solution that needs to executed some custom code, I understand that this is not something that is needed for every project...
When creating a sqlcmd file, is it posible to only include migrations afther a specific version. E.g. the baseline.
We have about 10mb of baseline scripts (excl most data) and updating a database takes a lot of time, because all the baseline scripts get executed on every database. This is good when creating a new database and is fast enough when you are updating 1 database, but on 500 databases, 10s means 10*500 seconds ~ 83min of checking if statements. We could manually delete Parts of the script, but manual script work is the reason we are now using readyroll...
Fyi: I don't mind a solution that needs to executed some custom code, I understand that this is not something that is needed for every project...
Comments
I understand where you're coming from, in that the package scripts can be slow to process through all the (already deployed) batches with each deployment.
As a first step, have you tried reducing the number of GO statements in your scripts at all? I know that this is a bit of a workaround but reducing the number of batches will mean less time spent evaluating IF statements.
There is an alternative approach you can use to deploying your database: the patch script method. Basically this will generate a script that contains just a delta of pending migrations for a given target server/database:
If you'd like to execute the migrations immediately you can add this to the above: Does that help at all?
Product Manager
Redgate Software
when I build the project with these parameters, I get some files in my bin folder:
{projectname}.sql
{projectname}_Package.sql
Am I correct that the {projectname}.sql contains the diff, and the {projectname}_Package.sql contains all scripts?
it would be awesome if that was the case! then we can generate a script for new databases and generate a script for the incremental upgrade.
Please let me know how you go with this.
Product Manager
Redgate Software
So for me it would be perfect to have an option described by wimrey to mark a specific version as baseline and exclude the prior migrations from the deployment script.
Product Manager
Redgate Software