v1.2.0 Summary Chapter 6: Advanced tools 6. Introduction 6.12. Objects metadata handling
You're browsing the documentation of a version that is still under development, the features described here may change or even be removed.

6.12. Objects metadata handling

The objects metadata handling feature, triggered by the icon in the Fix menu at the control toolbar, comes as a workaround for some lacking present in pgModeler. We call metadata all the attributes of objects or even whole objects that aren't converted into SQL code, existing only during design time. Examples of these metadata are tags assigned to tables, textboxes used for general documentation, objects' positioning information, relationships' colors and custom points, generic SQL objects, and some others.

This feature exists due to the following scenario: suppose that you have a fully detailed model with relationships organized by custom points and colors, textboxes being used as small documentation, tables graphically separated by the use of tags, and a set of generic SQL objects which hold some specific code for your database that is being created. Let's then assume that we've exported that model to a PostgreSQL server, so far so good. Now, for some reason, you started to make additions to your database (that one generated from the model), and don't worry about updating the original model. You've created a situation where the model is quite outdated compared to the database. But now you need an updated model of that database so you've to appeal to reverse engineering to get the new model. Of course, the reverse engineering feature is powerful enough to reconstruct the database on its most recent version but all those objects used to make custom documentation and styles of the original model are lost but you need them too. Since pgModeler can't compare a database against a model, updating the latter based on the first, there's no easy way to restore the object's positions, colors, documentation, and tags on the new model. Note that the inverse comparison, model against a database, is completely possible by using the diff feature.

So, this is where the object metadata handling comes to the scene. This feature copies all the metadata of an input model and applies it to another one. In our example, we use the oldest model as input, or to be more clear, from where we'll extract all metadata and apply them to our new database model (the most recent version of the database generated from reverse engineering). Note that the process matches the objects on the involved models by their names so it's recommended to use models that somehow are related, for instance, one being an older version of the other. The whole process can be tweaked by the following dialog.

Field/Option Description
Operation The following operation modes are available:

Extract and restore extracts the objects' metadata from the loaded models and applies it to the current focused model. A backup file can be specified where the focused model's current metadata will be saved.

Extract only extracts the objects' metadata from one of the loaded models saving the info to a backup file.

Restore a backup file reads the objects' metadata from a previously saved backup file and applies it to the current model.
Extract from The database model from where all the metadata will be copied. This list stores all the currently loaded database models on Design view.
Apply to The database model to where all the metadata copied from the model specified in Extract from will be applied. This is a read-only field and stores the name and filename of the working database model on Design view.
Backup file The file which will store the current metadata of the working model before applying a new set of metadata. This file can be used to revert the changes after applying metadata info from the Extract from model.
Database model metadata Handles the following database model attributes in the metadata file: author, zoom factor, last position, and default objects.
Objects' positioning Handles the objects' positioning in the metadata file.
Objects' Z stack value Handles the objects' z stack value in the metadata file.
Custom object's colors Handles the objects' custom colors in the metadata file. Currently available only for relationships and schemas.
Objects' SQL disabled status Handles the objects' SQL disabled status in the metadata file.
Objects' fade out status Handles the objects' fade out status in the metadata file.
Objects' aliases Handles the objects' aliases in the metadata file. Only for graphical objects and table's children objects.
Objects' protection status Handles the objects' protection status in the metadata file.
Objects' layers configuration Handles the objects' layers attributes in the metadata file.
Tables and views collapsing mode Handles the tables' and views' collapsing mode in the metadata file.
Custom SQL commands Handles the objects' custom SQL commands in the metadata file.
Textbox objects Save textboxes to the output file when extracting metadata. When loading the file, the textboxes are recreated, and duplicated ones are ignored.
Tag objects Save tags to the output file when extracting metadata. When loading the file, the tags are recreated, and duplicated ones are ignored.
Generic SQL objects Save generic SQL objects to the output file when extracting metadata. When loading the file, the objects are recreated, and duplicated ones are ignored.
Merge duplicated objects Textboxes, tags, and generic SQL objects from the metadata file will be merged into the ones that already exist in the database model.

Oct 31, 2024 at 09:12