FK and Draft FK

FK and Draft FK

From Conceptual to Logical

A foreign key is a set of attributes in a table that refers to the primary key (or unique constraint) of another table, linking these two tables.

In conceptual and logical level, foreign keys are defined from the entity. Each attributes has an FK fields. When selected, it indicates the attribute should be part of a foreign key constraint at a physical level.

Screenshot from 2025-08-21 14-49-29.png
Example of attributes of a conceptual entity

In this case we understand that team_id and country_id are referencing to other entities. Supposedly a Team entity and a Country entity.

Screenshot from 2025-08-21 14-50-56.png
Example of a logical model

In this case, both my entities have attributes marked as FK. We can suppose that drivers.team_id refers to teams.team_id. But the model does not include the other entities that would be referred by the other FK attributes (teams.power_unit_supplier_id, teams.country_id and drivers.country_id). Supposedly a power_unit_suppliers entity and a countries entity.

From Physical

Physical level brings a more advanced support of foreign key constraints. When converted FK attributes are converted to Draft FK attributes.

Screenshot from 2025-08-21 14-45-49.png
Example of a physical draft relationship in red

In physical level, foreign keys are defined from the relationships. Each relationships must link a set of source attributes (PK or Unique) to a set of target attributes (FK).

If a relationships doesn’t link 2 sets of attributes, it is considered a draft relationship and will be highlighted in red.

Screenshot from 2025-08-21 14-46-02.png
Foreign key constraint editor

To define the linked attributes from the relationships, use the foreign key constraint editor.

From the editor, you can see the Draft FK attributes as suggestions for target attributes.

Source attributes must be the the PK or a Unique constraint.

image-20250826-102153.png
Example of a physical relationship linking 2 attributes

How to open the foreign key constraint editor?

The foreign key constraint editor can be opened from the relationship context menu or the relationship editor.

image-20250821-115759.png
Right click on a physical relationship
Screenshot from 2025-08-21 14-57-30.png
Click on a physical relationship to open the relationship editor and then click on the key icon

Adding physical Draft FK to the entity page

By default, Draft FKs are only used when converting a model to physical level. In addition, the Draft FK field is not visible from the entity page. But it is possible to enable the field to let users define Draft FK from the entity.

image-20250821-162830.png
Attribute metadata settings page (Admin only)

As an admin, in the Metadata Settings, you can enable the Draft FK for the entity page.

Screenshot from 2025-08-21 19-26-19.png
Example of a configuration with Draft FK enabled to the entity page

Summary

Defining foreign key

Conceptual

Logical

Physical

Defining foreign key

Conceptual

Logical

Physical

From the entity

FK

FK

Draft FK (hidden by default)

From the relationship

Hidden by default

Hidden by default

FK