When defining your entities, you can specify their Identifiers and the relationships they have with other entities of your eSpace, through Reference Attributes.
In database terminology, the Identifier of an entity corresponds to its Primary Key and the Reference Attributes correspond to Foreign keys. OutSystems automatically creates the necessary database constraints as explained below.
When you define an attribute as an Identifier, the database creates a Primary Key constraint, prefixed as
OSPRK, as presented below.
CONSTRAINT OSPRK_<internal name> PRIMARY KEY CLUSTERED (<attribute>)
CONSTRAINT OSPRK_<internal name> PRIMARY KEY (<attribute>)
Only attributes where the Delete Rule property is set to Protected or Delete create a Foreign key database constraint. These constraints, prefixed as
OSFRK, depend on this Delete Rule property, as explained below.
CONSTRAINT OSFRK_<internal name> FOREIGN KEY (<reference attribute>) REFERENCES <Entity>(<attribute>)
CONSTRAINT OSFRK_<internal name> FOREIGN KEY (<reference attribute>) REFERENCES <Entity>(<attribute>) ON DELETE CASCADE