Model Relations

Last edit:  Jan 29, 2019

Contributors:  piotrze diana-lakatos pavelloz

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 model(join_on_property: String!) or the 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.

marketplace_builder/custom_model_types/house.yml

name: house
properties:
- name: address
  type: string

marketplace_builder/custom_model_types/cars.yml

name: cars
properties:
- name: color
  type: string
- name: house_id
  type: integer
  belongs_to: house

Questions?

We are always happy to help with any questions you may have. Check out our Help page, or contact us.