Compares and synchronizes schemas.
The cmdlet updates a target database to match a source database schema.
Invoke-DevartSyncDatabaseSchema -Source <object> -Target <object> [-FilterPath <string>] [-QueryBatchTimeout <int>]
[-Report <SwitchParameter>] [-ReportFilePath <string>] [-ReportFormat <string>] [-SynchronizationOptions <string>]
[-TransactionIsolationLevel <string>] [<CommonParameters>]
-Source <object>
Source to connect to a live database or loads database objects from the specified scripts folder or NuGet package.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Target <object>
Target schema to be updated.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-FilterPath <string>
Specifies the Schema Compare filter options used when performing the sync operation.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-QueryBatchTimeout <int>
Parameter is applied for each of the expressions in a synchronization script. This parameter will be ignored if the Target is not an object of the DevartDatabaseConnectionInfo.
Required? false
Position? named
Default value 30
Accept pipeline input? false
Accept wildcard characters? false
-Report <SwitchParameter>
Use this parameter to generate schema comparison report.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-ReportFilePath <string>
Path to the report file.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ReportFormat <string>
Specify the format of the comparison report.
Required? false
Position? named
Default value Html
Accept pipeline input? false
Accept wildcard characters? false
-SynchronizationOptions <string>
Specifies the Schema Compare options used during creation of the script for synchronization.
To include additional options, specify a slash-separated list of the options.
For example: /IgnoreCase:Yes /IgnorePrimaryKeys:No
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
For more detailed information about options, see the Options used in the command line topic.
-TransactionIsolationLevel <string>
Use this parameter to specify the isolation level for the transactions during the temporary deployment for validation.
Permitted values are: Serializable, Snapshot, RepeatableRead, ReadCommitted and ReadUncommitted. The default level is Serializable.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the following common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, InformationAction, InformationVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About Common Parameters.
System.Boolean (returns true on success and false otherwise)
---------- EXAMPLE 1 ----------
$syncResult = Invoke-DevartSyncDatabaseSchema -Source $connection -Target $targetConnection
Note
The Invoke-DevartSyncDatabaseSchema cmdlet does not allow you to perform a comparison without automatically synchronizing the source and target databases. When executed, the cmdlet adds the /sync key by default, triggering the synchronization process. >To obtain a comparison report without synchronizing, you may consider using the dbForge Schema Compare Pro or dbForge Studio for SQL Server Ent or Pro command line instead, and omitting the /sync switch. For example:
"C:\Program Files\Devart\dbForge SQL Tools Professional\dbForge Schema Compare for SQL Server\schemacompare.com" /schemacompare /source connection:"Data Source=DESKTOP-9NIVJ84\SQLSERVER2022;Initial Catalog=A1;Integrated Security=True;User ID=DESKTOP-9NIVJ84\1" /target connection:"Data Source=DESKTOP-9NIVJ84\SQLSERVER2022;Initial Catalog=A2;Integrated Security=True;User ID=DESKTOP-9NIVJ84\1"
If you require customized solutions in your DevOps pipeline, the dbForge tool command line offers a flexible alternative that can be tailored to your specific needs. By using this method, you can configure the command line according to your tasks, and execute the dbForge tool with the required options and parameters.
See Options used in the command line for a complete list of supported SynchronizationOptions.
See Using Object Filter to learn how to generate a Schema Compare filter options file.