Relationship attributes
This guide explains how relationship attributes work in Ellie and how to use them to define real foreign key constraints on relationships.
Overview
Relationship attributes define which attributes participate in a relationship-based foreign key constraint.
They are mainly used in physical models, where they determine how tables are connected and are used for DDL generation. The same feature can also be enabled for other levels if needed.
Enable the feature
By default, relationship-attribute features are available on the physical level. If you want to use them on other levels, an admin must enable the FK (Relationship FK) field for that level.
Go to Admin Tools → Metadata Settings.
Open the Attribute tab.
Make sure FK (Relationship FK) is enbaled for the level where you want to use relationship attributes.
Optionally enable Draft FK if you want to mark planned foreign-key attributes before defining a real constraint.
When FK (Relationship FK) is enabled, Ellie unlocks relationship attributes features for that level.
For details about the metadata fields themselves, see Attribute Metadata Settings User Guide.
How to define relationship attributes
There are two common workflows:
While creating a relationship
You can create a relationship directly between attributes on the canvas. In that case, Ellie tries to determine the relationship direction from the selected attributes, based on PK and Draft FK information.
If Ellie cannot determine the direction automatically, it creates a one-to-many relationship in the direction you drew the line. If the result is not correct, open Foreign key constraints and adjust it there.
For an existing relationship
Right-click the relationship line and select Edit foreign key constraints to open the dialog and add or adjust the relationship attributes.
You can also open it from the relationship editor.
Using the Foreign key constraints dialog
In the Foreign key constraints dialog:
The left side shows the table with the primary key attributes.
The right side shows the table with the foreign key attributes.
Flip lets you switch the source and target sides if they are not correct.
Select the matching attributes on both sides to define the foreign key constraint. If you select multiple attributes on both sides, Ellie creates a composite foreign key constraint.
For one-to-many relationships, Ellie keeps the defined attributes aligned with the relationship direction: the one side is the source, and the many side is the target. Because of that, using Flip also flips the relationship ends so the directions stay aligned.
On-canvas behavior
When you hover over a relationship, Ellie highlights the attributes that participate in that relationship. This makes it easier to verify which attributes are used in the constraint.
DDL generation
On the physical level, relationship attributes are used to generate foreign key constraints in DDL / SQL output. If relationship attributes are missing, Ellie can show the relationship visually, but it cannot generate the full foreign key constraint.
Import/export and API
Relationship-attribute data is also supported in Ellie import/export and API workflows. This makes it easier to move relationship-constraint information between Ellie and external systems.