Local development

In this setup the version control system holds the "master"-version of the system. The files should be versioned in such a way that new clones of the system can be created by checking out the files and using DbSync.exe -SetupDatabase.

Setup

The following computer setup is needed.

  • Local system - Each developers personal computer has one or more local instances of the system.
  • ID-database - A central database where id-values can be fetched to avoid collisions.
  • Version control system
  • Central development system - A development system that acts as a deploy source.
  • Deploy target (usually a Stage-system). See Deploy setups
graph TD ID[ID server] Local1[Local system 1] --> ID Local2[Local system 2] --> ID Local1[Local system 1] <--> VCS[Version control system] Local2[Local system 2] <--> VCS VCS -- Continous integration --> Central[Central development system] Central --> DeployTarget[Deploy target]

Database model changes

Database model changes can be made through Database Designer or through external tools like SSMS. If changes are made through external tools the deploy script has to be added manually.

Database designer

The setting "Development environment" should be set to "Local computer" when using local development. When enabled, DbSync.exe -FromDatabase will create files in the "DatabaseScripts"-folder for deploy scripts. These scripts should be checked in and will be executed in other developers' databases and the Central development system when they run DbSync.exe -ToDatabase. The exact flow depends on the version control system. See Version control specific info.

Review

It is recommended to review database model change scripts before they are pushed to the main branch, since making changes will either create unoptimized scripts or involves contacting all other developers.

System changes

These changes include changes that are not changed to the database model. That is Softadmin® object (for example menu items) and SQL objects (for example stored procedures), files on disk etc.

To push changes the developer should:

  1. Check out the code from the version control system.
  2. Make the changes.
  3. DbSync.exe -FromDatabase
  4. Push changes to the version control system.

Review

An external tool compatible with the version control system should be used for code review.

Getting other peoples' changes

To get other peoples' changes:

  1. Check out the (updated) code from the version control system.
  2. Use DbSync.exe -ToDatabase when updating the current branch or DbSync.exe -SetupDatabase when setting up a system from a new branch.

Continuous integration

The purpose of this step is to move code from the Version Control System to the Central development system.

How this is triggered is up to each project, and is dependent on project needs and version control system. This may be triggered either automatically or manually.

Since the requirements vary and Softadmin® is no bound to a single version control system there is no single tool to handle this. Usually each project modifies their own scripts for their specific needs, usually bundled as a Powershell script. The tool DbSync does however help this process.

The script should:

  • Check out latest version from the version control system to disk.
  • Trigger -ToDatabase to apply all changes to the Central development system.
    DbSync.exe -ToDatabase

Regresstion tests

  • Regresstion tests may be done in the Central development system before deploy.

Deploy

From the Central development system the normal deploy flow i used.

DbSync

New branch/database

To set up a new branch or a new database.

DbSync.exe -SetupDatabase -Database ExampleDatabase -Server localhost\SqlExpress -ModuleIds 1 90000 300000

Database to disk

After normal development only module 1 need to be checked in.

DbSync.exe -FromDatabase -Database ExampleDatabase -Server localhost\SqlExpress -ModuleIds 1

After an upgrade all modules need to be checked in.

DbSync.exe -FromDatabase -Database ExampleDatabase -Server localhost\SqlExpress -ModuleIds 1 90000 300000

Disk to database

After normal development only module 1 need to be checked in.

DbSync.exe -ToDatabase -Database ExampleDatabase -Server localhost\SqlExpress -ModuleIds 1

After an upgrade all modules need to be checked in.

DbSync.exe -ToDatabase -Database ExampleDatabase -Server localhost\SqlExpress -ModuleIds 1 90000 300000

Version control specific info

Development in a single main branch (SVN)

Typically done in Subversion and similar version control systems.

Development in feature branches (GIT)

Typically done in GIT and similar version control systems.