Summary Chapter 6: Advanced tools 6. Introduction 6.12. Objects metadata handling

6.12. Objects metadata handling

The objects metadata handling feature, triggered by the icon at the controls toolbar, comes as a workaround for some lackings 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, relationship colors and points, generic SQL objects and some others.

One may ask the reason of this feature to exist and the response could based upon the following: 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 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 not worrying about to update the original model. You've created a situation where the model is quite outdated compared the database. But now you need an updated model of that database so you've to appeal to the reverse engineering to get the new model. Of course, the reverse engineering is powerful enough to reconstruct the database on its most recent version but all those objects used to make custom documentation and style of the first model are lost but you need them too. Since pgModeler can't compare a database against a model, updating the latter based upon the first, there's no easy way to restore the objects positions, colors, documentations, tags, etc on the new model. Note that the inverse comparison, model against a database, is completely possible by the diff feature.

So, this is where the objects metadata handling comes to scene. Basically, this feature copies all the metadata of an input model and applies it to another one. In our example, we'll use the oldest model as input, or being more clear, from where we'll extract all the metadata and apply it to our new database model (the most recent version of the database, remember?). Note that the process matches the objects on the involved models by their names so it's recommend to use models that somehow are related, for instance, one being an older version of the other. All the 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 apply to the current focused model. A backup file can be specified to 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 apply to the current model.
Extract from The database model from where all the metada 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. 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 apply a new set of metadata. This file can be used to revert the changes after applying metadata info from the Extract frommodel.
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.
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.
Tables' extended attributes display Handles the tables' and views' extended attributes display status 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.

Oct 17, 2018 at 14:09