Database Synchronization Wizard
Last updated
Last updated
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 are JSON files that contain meta data about the tables and columns in a database. These files are used in team development to keep every developer's database synchronized with each other.
To view exactly what is in a DBI file:
Open the Resource perspective.
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.
There are a couple of Servoy Developer features used for changing the local database.
This wizard will assist with synchronizing the DBI files with the local developer's database by 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:
In the Solution Explorer, right click on one of the following:
The resources project
The database servers node under the resources project
The desired database under the database servers node
Select Synchronize with DB server information.
A wizard will appear. Walk through the wizard to update the databases
As is clearly visible in the image, you may choose for:
Sychronize DBI files with database structure
Reload tables from database structure
For tables that are present in both the database and the resources project with an associated database information file, the column details may vary.
Differences in column information between the database and the database information files become apparent only when these files are accessed. Since these files are read as needed, you may need to initiate a load to observe these differences in the 'Problems' view. Having a database information file for each table aids in maintaining consistent database structure across multiple developers using a team provider. In the depicted scenario, the wizard has identified that some database information files available on the local database are missing on the server. This indicates that the local database contains additional tables that are not documented in the DBI metadata. If a table lacks a DBI file, Servoy will generate one in memory, so its absence is not necessarily problematic.
Tables that are present both in the database and have a corresponding database information file in the resources project can exhibit variations in column information. These differences between the database and the database information files only become noticeable when the latter are accessed. Because these files are only read when necessary, you may consider initiating a load to observe these differences in the 'Problems' view. To synchronize the DBI files with the local database server at the column level, a new wizard can be launched at this stage. Servoy processes the table columns on demand, as reading them can be time-consuming.
The wizard provides options to address discrepancies between the database and its information files, such as the option to update the DBI file or delete the column from the database when a column is present in the database but not in the DBI file, ensuring consistent database structures and data integrity.