What is the Data Model?

The Data Model defines the structure of the Database that will be used by your app. JourneyApps supports a simple relational data models:

  • Define the Models that are required in the app

  • Each model will have a number of Fields which describes the type of data which is stored for each model.

  • Relationships between Models are used to link related models, for example a one-to-many relationship.

  • Special fields for default display values, app indexes, and configuring webhooks.

Learn more about relational databases

Understanding the basics of relational databases will simplify the design of your app's data model significantly. If you are not familiar with relational databases, we suggest that you read more about them using online resources.

A single, common Data Model

A valuable feature of JourneyApps is that the Data Model for an app only needs to defined once in OXIDE, and is used throughout the JourneyApps Cloud. Once you've defined your Data Model it will be used by the application, the Backend, the API and all other related JourneyApps services.

Syntax

This is an example of a Data Model for a simple asset management app. It contains two models, asset and building. Most of the data collected are for the assets, and a building can have many assets - a one-to-many relationship.

For details, see how to configure your data model.

schema.xml
<data-model>
  <model name="asset" label="Asset">
    <field name="make" label="Make" type="text:name"/>
    <field name="model" label="Model" type="text:name"/>
    <field name="serial_number" label="Serial Number" type="text:number"/>
    <field name="description" label="Description" type="text"/>
    <field name="picture" label="Picture" type="photo"/>
    <field name="condition" label="Condition" type="single-choice">
      <option key="good">Good</option>
      <option key="ok">Ok</option>
      <option key="bad">Bad</option>
    </field>

    <belongs-to model="building"/>

    <display>{make} {model} {serial_number}</display>
  </model>

  <model name="building" label="Building">
    <field name="name" label="Name" type="text:name"/>

    <has-many model="asset" name="assets"/>

    <display>{name}</display>
  </model>
</data-model>

Last updated