Child pages
  • Updating a Local Database Using DBI Files
Skip to end of metadata
Go to start of metadata

In This Chapter

Overview

When using a local database instance for each developer, there is a need to make sure the database is up to date structurally. Most team providers will update the DBI files that store the database metadata, but these providers do not actually change the database. Changing the database is done in Servoy using Servoy's toolset. Servoy will modify the database, and also alert the developer if there is changes that require developer intervention.  Changes are considered at the table level and at the column level.

DBI Files

DBI Files are JSON files that contain meta data about the tables and columns in a database.

To view exactly what is in a DBI file:

  1. Open the Resource perspective.
  2. Expand the Resource project and right-click the desired file. From the contextual popup, select Open With > Text Editor and view the resource as a JSON file.

Syncing DBI Files with the Local Database

There are a couple of Servoy Developer features used for changing the local database.

Synchronize With Database Wizard

The synchronize with database wizard will allow creation and deletion of tables in database based on DBI file information. It will also create columns associated with these tables.
 
To launch the wizard:

  1. In the Solution Explorer, right click on one of the following:
    1. The resources project
    2. The database servers node under the resources project
    3. The desired database under the database servers node
  2. Select Synchronize with DB server information.
  3. A wizard will appear. Walk through the wizard to update the databases

Problems Tab Quick Fix

Unfortunately, the wizard will not fix any differences with existing tables in the database. Any differences between the DBI files and the local database will show up in the Problems tab, and these differences can be fixed using the Quick Fix menu option.
To use the Problems tab:

  1. Find the error in the Problems tab indicating that the DBI file is out of sync with the database. Right-click the error and from the contextual popup, select Quick Fix
  2. The quick fix dialog will appear. There are normally two options: to change the DBI file or to change the local database. Depending on which is correct, make the appropriate selection and click Finish.
  3. Note that if there are similar errors, you may choose to do the same action across all error of the same type. This will be the default behavior, but if you want just one or a few, you may clear the checkboxes in the problems list before clicking Finish.
  4. In the problems list, if there are new tables that have not been synced yet, you may see a warning indicated the table does not exist in the database. You may use Quick Fix to open the synchronize with database wizard as well.

Some Notes about Team Development and Database Synchronization

  • Database column changes will sometimes remove the data from the column (this is dependent on the platform and the type of change). This cannot be undone without a restore of the database from back up. Normally in development, there is little data in a database, but be careful.
  • Do not simply walk through the synchronization and quick fix wizards. You must think about the choices you make when making selections. For the most part, the reason differences appear is because another developer has changed the database for some reason. It very easy to get into a 'loop' because one developer has added a database object and another one has destroyed it and changed the DBI file, then committed the change. Communication between developers is key when making database changes in the solution.
  • No labels