Database Schema
We will be using two tables for our app. You can create these tables from the Hasura console.
Users
The users
table will contain two fields
- auth0_id: text primary key unique
- name: text
Todos
The todos
table will contain the following fields
- id: text primary key unique
- userId: text
- text: text
- isCompleted: boolean
- deleted: boolean; default: false
- createdAt: timestamp with timezone, default: now()
- updatedAt: timestamp with time zone, default: now()
Permissions
A user is able to create, select, update and delete only todos that belong to them. This can be enforced by setting permissions as shown below:
Did you find this page helpful?
Start with GraphQL on Hasura for Free
- Build apps and APIs 10x faster
- Built-in authorization and caching
- 8x more performant than hand-rolled APIs