The Schema Compare tool of dbForge Studio for PostgreSQL incorporates a built-in Command Line Wizard that allows converting the project’s schema comparison and synchronization options into command-line syntax and save it as a *.bat file.
It is a very convenient feature when it comes to scheduling or automating database comparison and synchronization. You can then use a *.bat file with a script and Windows Task Scheduler or any other task scheduler tool available to schedule the database comparison or synchronization.
You can select command-line file settings to manage *.bat file text in the Command line execution file settings window. You can open the window by clicking the Save Command Line button in:
The command line wizard has the following options:
Name | Default State | Description |
---|---|---|
Comparison Project | No | Load command-line settings from the previously created comparison project file with the .scomp extension. |
Source | Yes | Specify the source options: server, database, port, user, password, and connection. |
Target | Yes | Specify the target options: server, database, port, user, password, and connection. |
Comparison Options | No | Set options to manage the comparison process. |
Report | No | Generate a schema comparison report file. |
Report Format | No | Specify the format of the file comparison report: HTML, XLS, and CSV (selected by default). If not specified, the format of the file comparison report takes the exension of the report file. |
Log File | No | Generate a comparison log file in the specified directory. |
Synchronization | Yes | Start database synchronization. If an output file is specified, only synchronization script will be generated. |
Synchronization Options | No | Set options to manage the synchronization script. |
Synchronization File | Yes | Specify a path to the database synchronization script file. |
Execute | No | Execute the file received in the result of the previous commands execution. |
Error Code | No | Enable the processing of error levels. |
Arguments File | No | Specify a command-line arguments file. If a path to the arguments file is specified, a separate command-line file will be generated. |
Echo OFF | No | Disable echoing all commands in the batch file. All the text in the batch file is enclosed in the @Echo OFF … @Echo ON command. |
Keep opened | No | Set a pause command at the end of the batch file text. The command window will be opened. |
PowerShell | No | Generate the & symbol at the beginning of the batch file text. This makes the batch file compatible with PowerShell. |
After setting the required options for the potential script, you can click Validate to check the accuracy of the code.
If the syntax is valid, you receive the following message:
Otherwise, the correspondent warning will be displayed:
After validating the code, you can save the script as a *.bat file by clicking the Save button and specifying a path to its location.