Basic version control using DbSync

 Show all Hide all

The DbSync command line tool assists version control of a Softadmin® system by exporting the database to SQL scripts on disk. These script files can then be checked into your VCS of choice for safekeeping and code review. The tool ships with every Softadmin® installation and can be found in the SyncTools folder. It is commonly called from an installation-specific cmd file stored next to it in the SyncTools folder.

Exporting SQL modules

DbSync.exe -SqlModulesFromDatabase -Database SouthWater -Server localhost\SqlExpress -ModuleIds 1 -NoStubs

The SqlModulesFromDatabase command will, when executed from the SyncTools folder, export all procedures, functions, views and triggers to a folder called Database in the project directory.

The Database and Server arguments are used to choose the database to export from. The tool will use the caller's Windows credentials to connect to the SQL server.

ModuleIds 1 specifies that only system-specific code should be exported and Softadmin's own SQL modules objects should be ignored.

NoStubs is used to suppress the creation of a special .stub.sql files for each procedure and function. Those files are relevant in more advanced use-cases but not for version control.

Advanced flags

The Force flag is used to force a complete export. Normally if you have previously performed an export then the tool will compare the modify date of the files on disk with the modify date of the SQL modules in the database and only export those modules that have changed.

The Verbose flag is used to make the tool more chatty. You normally use it when trying to troubleshoot by calling the tool manually from the terminal.