Homepage

Records and Tables

Last edit: Nov 03, 2023

What is a Table?

Table is an object that describes all Record objects that belong to it.

Tables define object types that will exist in your application. They describe the properties each object can have. For example, if you want your application to manage "books", you can create a Table with the name "book" that will have the properties "title" and "author" (both having the type "string"). The main function of a Table is to allow you to define the structure of your data.

What is a Record?

A Record must always be associated with exactly one Table. Using the book analogy, individual books in your application will be Record objects tied to the "book" Table, and you will be able to set actual values for the "title" and "author" of each book. For example, one of your records could be a record with the title "1984" and the author "George Orwell". The main function of a Record is to persist actual data in a system.

Head to the Persisting Data With Records tutorial to fully understand the process based on a TODO list example.

Tables use cases

  • Build highly customized features
  • Use them to group Properties, and allow the user to provide multiple values for each of them

For example, you can build a Table that will store a user's favorite books. Each book has an author, title and a number of pages. These three fields are Properties. That’s why you can use Table to group Properties.

Now you can build a form that allows users to add multiple books attached to them (using GraphQL).

Soft and hard delete

Read Data Backup and Removal to get familiar with data retention and backups in platformOS.

Defining

Tables are placed in the schema directory.

The example below shows the BlogPost Table schema/blog_post.yml:

name: blog_post
properties:
  - name: title
    type: string
  - name: content
    type: text

Configuration Properties

Property Description Required
name Name of your Table. Best practice is to keep it lower case. Example: user_application Yes
properties Array of properties you want to contain within your records. Equivalent to a column in a database table. No

Questions?

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

contact us