8.2.2. Split database model format

This plug-in introduces a new file format to store database models called the split database model (.sdbm). It was designed to improve the version control of model files by saving the XML code of the objects in individual files. This way, it is easier to track the changes made in each database object when the model is handled by several people in a team. For now, pgModeler only saves and loads the split database model. Below, is an example of how the split database model is arranged:

The .sdbm is a variant of the classic .dbm file where some metadata of the database model are stored but with the difference that in this file instead of having all objects' XML code attached there are references to database object files .dbo which in turn store the XML code that defines each object. Each .dbo file is categorized and saved in the folder related to the database object type. For example, the database definition is stored in the file demodb.dbo in the subfolder database. The table schema_a.table_e is saved in schema_a_table_e.dbo in the folder table, and so on. The following image shows an example of the demodb sample model saved in split mode.

pgModeler still relies on the classic .dbm files when loading the split database model. In resume, when opening a .sdbm, pgModeler reconstructs the entire database model by parsing the .sdbm and .dbo files creating a temporary .dbm file where all the modifications will be applied during design time. Every time the user saves the model pgModeler automatically updates the split database model definition so it can stay synchronized with the temporary one.

To help the user to identify the database model file types that are being handled, pgModeler shows, at the base of the design area (see the image) the badges Split model for models loaded from .sdbm and Single model for models loaded from .dbm files. When working with split models, both badges are displayed to indicate that pgModeler is taking care of the original .sdbm and the temporary .dbm file created from the loading process of the split model. Finally, if you are working with a classical .dbm file and want to save it in the split format, just click the action to create a split version of the model.

8.2.2.1. Handling split database models in CLI

The pgModeler command-line tool also provides some operations that can be performed over split database models. The first one, --export-sdbm allows the user to export a split database model (.sdbm) like it was a common (single) database model file (.dbm). The other option, --fix-sdbm, is used when you have a broken split database model file and need to fix it so it can be loaded again in pgModeler's graphical user interface.

pgModeler command line interface.
Version 1.1.2 - 20240325.a5f369d37 Qt 6.6.2
PostgreSQL Database Modeler Project - pgmodeler.io
Copyright 2006-2024 Raphael Araújo e Silva 

...

Plug-ins options: 
  -lp, --list-plugins               List the available plug-ins.
  -ip, --ignore-faulty              Ignore the errors of plug-ins that failed to be loaded.

SDBM export plug-in options: 
  -xs, --export-sdbm                Runs the export operation over a split database model (.sdbm)

SDBM fix plug-in options: 
  -fs, --fix-sdbm                   Runs the database model fix operation over a split model file (.sdbm)

...


Note that those options need to be used together with one of the export options or with the model fix operation switch, see the following examples:

  • Exporting a split database model to PNG image:
    ./pgmodeler-cli --export-sdbm -ep -if ~/demo_split/dbmodel.sdbm -of ~/demo_split/dbmodel.png

  • Fix a split model's structure:
    ./pgmodeler-cli --fix-sdbm -fm -if ~/demo_split/dbmodel.sdbm -of ~/demo_split/dbmodel_fixed.sdbm


Mar 25, 2024 at 10:24