Records and Tables
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.
Tables are placed in the
The example below shows the BlogPost Table
- name: title
- name: content
|Name of your Table. Best practice is to keep it lower case. Example:
|Array of properties you want to contain within your records. Equivalent to a column in a database table.