Additional Scripts are a re-usable type of T-SQL script that allow you to include logic to deploy the same object more than once (i.e. using DROP and CREATE statements).

The concept of additional scripts is actually very similar to Programmable Object scripts. The difference being that you control the structure and content of the scripts within the nominated folders, as opposed to the programmable objects folder, which is managed by the ReadyRoll tool-window (i.e. when you import changes within the tool-window, ReadyRoll modifies the scripts within the programmable objects folder).

Additional Scripts can be included in your project build/deployment by adding a custom folder using the project properties window.

When to use Additional Scripts

Types of objects that are suitable for deployment as Additional Scripts:

Types of objects that are NOT suitable for deployment as Additional Scripts:

Please note that ReadyRoll does not have any capability to generate scripts for the above types of objects/data. ReadyRoll simply applies the deploy on change convention to allow you to include custom, repeatable scripts as part of your database deployment process.

Scripts that follow this convention need to be written in an idempotent way: they should be runnable many times with no loss of state within the target database.

How to add an Additional Scripts folder

By default, ReadyRoll does not contain any additional script folders. In order to add one, first add it to your project using the Solution Explorer.

Then, right-click the project node in Solution Explorer and select Project Properties.

Scroll down to the Additional Scripts section of the Project Settings tab. A list containing a list of user folders will appear.

Check the newly-added folder to flag it as an additional scripts folder. Leave unchecked any folders that you do not wish to include in your deployment.

You can then add .sql files to your folder. These will be picked up at build time by ReadyRoll, syntax checked and included as part of your deployment.

Controlling the order of execution

Additional Scripts execute against your database after all incremental migrations have been applied.

If you need to control the specific order that your Additional Scripts migrations are deployed, this can be set within the Project Properties by dragging and dropping items into the required order: