Deploying SQL Change Automation Projects
Published 01 August 2018
SQL Change Automation provides a set of PowerShell cmdlets for deploying projects, as well as several add-ons for easy integration with several popular Continuous Integration and Continuous Deployment tools. This page provides a summary of the options you have for deploying your SQL Change Automation project.
We recommend deploying SQL Change Automation projects using the PowerShell release components. Please note that this feature is not available to SQL Change Automation Core users.
The PowerShell cmdlets can be used to automate database deployments by writing deployment scripts like the one below.
This example will build and deploy the project to the live database specified in the database connection.
# Path to a SQL Change Automation project $project = "C:\Repos\MyProject\MyProject.sqlproj" $validatedProject = Invoke-DatabaseBuild $project # Build the project, creating a build artifact $buildArtifact = $validatedProject | New-DatabaseBuildArtifact -PackageId MyDatabase -PackageVersion 1.0.0 $buildArtifact | Export-DatabaseBuildArtifact -Path "C:\packages\buildArtifacts" -Force
$prod = New-DatabaseConnection -ServerInstance "localhost" -Database "EmptyDb" # Use the build artifact we just created $build = Import-DatabaseBuildArtifact "C:\packages\buildArtifacts\MyProject.1.0.0.nupkg" # Create the deployment artifact $update = New-DatabaseReleaseArtifact -Source $build -Target $prod # Deploy the project Use-DatabaseReleaseArtifact $update -DeployTo $prod
See Getting started with the SQL Change Automation PowerShell components for more information.
SQL Change Automation can be used by any CI/CD server that supports PowerShell.
We also provide add-ons for a selection of tools, including Visual Studio Team Services, Team Foundation Server and TeamCity.
SQL Source Control Projects
SQL Change Automation can also deploy SQL Source Control projects.
SQL Change Automation Core
SQL Change Automation Core does not support the SQL Change Automation PowerShell components. However, it is still possible to build the project with MSBuild and deploy the artifacts directly.