Home platformOS Logo

Model Relations

Last edit: Apr 15, 2020

With properties, you can create your custom fields for storing the data. In the properties, you can also store the id of an existing object. Then you can fetch the data with related_model(join_on_property: String!) or the related_user(join_on_property: String!) field in GraphQL.

In order to export/import data with relations preserved, you need to define them in model schema files using the belongs_to attribute.

app/model_schemas/house.yml
name: house
properties:
- name: address
  type: string
app/model_schemas/cars.yml
name: cars
properties:
- name: color
  type: string
- name: house_id
  type: integer
  belongs_to: house

Contribute to this page

Github Icon

Questions?

We are always happy to help with any questions you may have.

contact us