SR060

Severity: error

Summary: belongs_to relation is missing required key field

What this means

A belongs_to relation has no key: attribute. The key names the local foreign key field in this resource’s schema that holds the ID of the related resource. Without it, Shaperail cannot generate the join or the foreign key constraint.

Example that triggers this

relations:
  org: { resource: organizations, type: belongs_to }

How to fix it

Add key: <local_fk_field> to the relation:

org: { resource: organizations, type: belongs_to, key: org_id }

Back to top

Shaperail documentation lives in the same repository as the framework so every release has versioned instructions. See the latest release for the most recent version.

This site uses Just the Docs, a documentation theme for Jekyll.