Deploying database packages
Published 07 August 2013
If you are deploying an application and a database at the same time, we recommend that you add the database as the first deployment step.
There are two reasons for this:
- Failed database deployments are rolled back
The SQL script Deployment Manager uses to deploy a database runs inside a transaction. If the scripts fails, any changes are rolled back automatically, and Deployment Manager does not perform the next deployment steps. - Database deployments can take longer than application deployments
While Deployment Manager is deploying multiple components, there will be a period of time when only part of a deployment has been completed. For example, if your web application package step is before your database package step, there will be a period during the deployment when the website has been updated, but the database upgrade is still in progress. Database deployments can take a long time, so if you deploy the database first, you minimize the period of time when components are out of sync during the deployment.
Setting up a database deployment step
To set up a database for deployment, see Configuring a database package step.
Database variables
When using a database package step, but you can specify variables to change the deployment options for different environments and targets:
- RedGateDatabaseServer
The SQL Server you want to deploy to. - RedGateDatabaseName
The database you want to deploy to. - RedGateDatabaseIntegratedAuthentication
If you want to use Windows authentication to connect to the SQL Server, specify True. If you do not use Windows authentication, you need to also specify a username and password. - RedGateDatabaseUserName
The username you want to use to connect to the SQL Server. You do not need to specify a username ifdatabaseIntegratedAuthentication
is set to True. - RedGateDatabasePassword
The password to connect to the SQL Server. You do not need to specify a password ifdatabaseIntegratedAuthentication
is set to True. - RedGateDatabaseMode
The type of upgrade you want Deployment Manager to perform. You can specify either upgrade if you want to upgrade the database, or createnew if you want to drop and recreate the database. RedGateDatabaseAllowDynamicUpgrade
If you want Deployment Manager to perform a dynamic database upgrade, specify True.
However, Deployment Manager will always perform a static upgrade if the package contains an upgrade script it can use, even if this this variable is set to True.For more information, see: How Deployment Manager upgrades databases.
RedGateDatabaseAllowPreDeployValidation
If you want Deployment Manager to validate the upgrade before deployment, specify True.Deployment Manager can only validate a static upgrade (validating dynamic upgrades before deployment is not currently supported).
- RedGateDatabaseAllowPostDeployValidation
If you want Deployment Manager to validate the upgrade after deployment, specify True. - RedGateDatabaseAbortOnWarningLevel
If you want Deployment Manager to cancel a deployment if there are any deployment warnings, specify High, Medium, Low, Info or None.