Data and users
Tables
Model application data with PostgreSQL tables, typed fields, relations, indexes, validation, and access rules, all from the Project console.
Table types
| Type | Use it for |
|---|---|
Base | Ordinary application data such as posts, orders, or products |
Auth | Application users who sign in, with your own profile fields added |
View | Read-only results of a SQL query, such as reports or summaries |
Create a table
- Open your Project and select Tables.
- Select New table and choose Base, Auth, or View.
- Add fields. Each field has a type and options such as required, unique, or a maximum length.
- Add relation fields to link records in other tables.
- Add indexes for fields you filter, sort, or join on.
- Set the API rules for list, view, create, update, and delete before any app uses the table.
- Save. The table's REST endpoints are ready at once. Open API Preview to see them.
Field types
- Text, number, boolean, email, URL, and date
- Select (one or many fixed options) and JSON
- File (one or many uploads) and relation (links to other records)
- Geographic point, password, and automatic created/updated dates
API rules
Each rule is a filter that must match for the request to be allowed. Leave a rule empty to allow everyone, or lock it to allow only superusers and API keys.
| Rule | Example | Meaning |
|---|---|---|
List / View | @request.auth.id != "" | Only signed-in users |
Update / Delete | owner = @request.auth.id | Only the record's owner |
Create | @request.body.owner = @request.auth.id | Users can only create records for themselves |
Changing a table later
Renaming or deleting a field changes live data and can break apps that use it. Take a backup and update your app before changing tables that are already in production.
Found something wrong on this page?
Fix it yourself. The link below opens this file in GitHub's editor and forks the repository for you if you need one, and your change becomes a pull request without leaving the browser.