Extend Data Models
You can extend the SimpleOne data model by adding columns to existing tables. Remember that the updated data model is applied to all child tables, as new columns are also inherited from parent tables. If you need to extend the data model without creating columns, use the following methods:
- Inheritance
- Adding REM attributes
Inheritance
Inheritance is the extension of tables with child data structures that inherit all the attributes of the parent structure and have their own. Inheritance allows you to avoid many duplicate columns and build a hierarchical structure of objects where each following child element is a narrower subset. The inheritance can be multi-level; a child table can be a parent table for other tables.
When using inheritance keep in mind that many engines can also work within child entities. For example, business rules, user roles, client scripts, and others.
The inherited values and logic related to the table can be overridden for child tables.
The inheritance mechanism works correctly with a few child tables that have many common attributes between them. As the number of child pages increases and the number of common attributes decreases, it becomes difficult to manage such a data model.
Disadvantages of a data model with a complex inheritance structure:
- Too much storage space is required to store records.
- Scripts are executed slower.
- It becomes difficult to configure features related to a table such as data import, form view configuration, and others.
An example of complex data model is the template service catalog. It consists of a parent table for the catalog and table records for each request template with specific attributes.
Record extended model
When using the record extended model (REM), no new tables or columns are created. Instead, new data attributes are created that are selectively applied to specific table records. When an extended model is applied to a record, an additional set of records is created for the model that stores information about the values of specific attributes. Thus the record has attributes received from the table and attributes received from the record extended model (REM attributes).
The REM attributes allow you to avoid the limitations of the inheritance mechanism by adding record attributes that are not inherited by child tables. Without the REM attributes, it is necessary to create many child tables, each adding one column. Besides, the REM attributes can be collected into REM models that categorize objects from the same table. An example of such a use case is the REM service catalog.