Using the sync command
Published 23 July 2015
To run the SQL CI sync step, use this syntax:
sqlCI.exe Sync /databaseName=<value1> /package=<value2> /databaseServer=<value3>
Example
sqlCI.exe Sync /databaseName=WidgetShop /package=WidgetShop\Database\Output\WidgetShop.1.0.nupkg /databaseServer=SQLServer2012
Here are details of all the sync command switches:
/databaseName
The target database to update with the changes in source control.
Example
/databaseName=WidgetDB
This must be an existing database on the server; the sync command won't create the database for you.
Contents:
/package
The path to the package that was created in the build step.
Example
/package=WidgetShop\Database\Output\WidgetShop.1.0.nupkg
/databaseServer
The target database server name.
Example
/databaseServer=SQLServer2012
/databaseUserName (optional)
The username for SQL authentication.
Example
/databaseUserName=sa
/databasePassword (optional)
The password for SQL authentication.
Example
/databasePassword=password
/additionalCompareArgs (optional)
Specifies additional command line switches to pass through to SQL Compare.
For example, to abort an operation when there are changes that might result in data loss, pass through the /AbortOnWarnings
switch like this:
Example
/additionalCompareArgs="/AbortOnWarnings:Medium"
The switch values should always be surrounded by double quotes.
SQL CI already uses SQL Compare's /Options
switch with its own set of default values. To include additional options, use the following syntax:
Example
/additionalCompareArgs="/Options:DoNotOutputCommentHeader,ForceColumnOrder"
The option values are not case sensitive.
You can also use aliases if you prefer shorthand versions of the options. For details of the alias for each option, see Options used in the command line.
Example
/additionalCompareArgs="/Options:nc,f"
To exclude options, prefix the option with a minus sign. For example:
Example
/additionalCompareArgs="/Options:-IncludeDependencies,-IgnoreWhiteSpace"
The default options (with aliases in brackets) used for data comparison are:
- DecryptPost2KEncryptedObjects (dp2k)
- IgnoreFillFactor (if)
- IgnoreWhiteSpace (iw)
- IncludeDependencies (incd)
- IgnoreFileGroups (ifg)
- IgnoreUserProperties (iup)
- IgnoreWithElementOrder (iweo)
- IgnoreDatabaseAndServerName (idsn)
- IgnoretSQLt (itst)
- UseCompatibilityLevel (ucl)
If the target database you're syncing to contains tSQLt tests, you must exclude the IgnoretSQLt option.
You can include some options and exclude others. For example:
Example
/additionalCompareArgs="/Options:IgnoreConstraintNames,NoTransactions,-IgnoreFillFactor"
If the switch value contains double quotes, you need to escape them with a backslash. For example, if the switch value is /TIL:"READ COMMITTED", use the following syntax:
Example
/additionalCompareArgs="/TIL:\"READ COMMITTED\""
If you're running sqlCI.exe in PowerShell, you must also insert the backtick character (ASCII 96) to escape each double quote. For example:
/additionalCompareArgs="/TIL:\`"READ COMMITTED\`""
For more information, see Windows PowerShell: about_Escape_Characters (TechNet article).
If you don't insert the correct escape characters, the switch value will be invalid.
For more information about SQL Compare command line options and switches, see Using the command line (SQL Compare Documentation).
/licenseSerialKey (optional)
To activate the DLM Automation Suite license on the machine the build agent is running on, enter the serial number.
Example
/licenseSerialKey=123-456-789012-ABCD
For information on finding your DLM Automation Suite serial number, see Legacy licensing. If you don't enter a serial number, a 28 day free trial of the DLM Automation Suite will start automatically.
If you have multiple serial numbers, separate them using commas without spaces.
Example
/licenseSerialKey=123-456-789012-ABCD,321-456-987654-DCBA