DLM Automation

Switch from SQL CI Sync command to PowerShell

This page shows you how to create a PowerShell script using the DLM Automation cmdlets that's equivalent to the SQL CI Sync command.

The SQL CI Sync command updates an existing database with the schema in the NuGet package created by the Build command.

This example uses the Sync command in SQL CI to update the WidgetShop database:

Command line example

sqlCI.exe Sync /package='C:\packages\WidgetShop.1.0.nupkg' /databaseServer=SQLServer2014 /databaseName=WidgetShop

Here's the same example using the DLM Automation PowerShell cmdlets:

PowerShell example

$source = "C:\packages\WidgetShop.1.0.nupkg"
$target = New-DlmDatabaseConnection -ServerInstance "SQLServer2014" -Database "WidgetShop"
Sync-DlmDatabaseSchema -Source $source -Target $target

In the example above:

Didn't find what you were looking for?