Ids
Every record has a primary key,id by default. Choose its type when you create the resource (it can’t be changed later):
New resources use ULIDs or UUIDs; existing integer-keyed tables keep working and can be re-saved. ULIDs sort by time, so ordering by
id is the same as ordering by creation.
Studio: Settings → ID type and Primary key (the column name, default id).
Don’t send an id on create. Pawabase assigns it, and returns it in the response.
Timestamps
Withtimestamps: true (the default), every record has:
They are ISO 8601 strings in UTC. They are read-only: your writes can’t set them. Order by them for “newest first”:
Africa/Lagos, Europe/Berlin) on the resource is for presenting and for schedules that read it; stored times stay UTC. Empty means UTC.
The owner column
Many tables belong to a person. Setowner_field to the column that holds their id:
Settings → Owner field. Filled with the caller’s user id on create.
Two things then happen:
- On create, the column is filled with the signed-in person’s id, so your app doesn’t need to send it (and a person can’t create a record for someone else).
- The
ownerrule compares that column with the caller on every list, get, update and delete.
author_id, customer_id), pass it to the rule as Owns the record (author_id). See Access rules: writing rules.
Organization scoping
For team data, add anorg column and a rule that compares it with the caller’s active organization:
- All of these rules pass:
- Check a value:
$auth.orgis set - Compare values:
$record.orgequals$auth.org
- Check a value:
org: session.org on create. See Organizations.
Columns and types
Your own columns.
Access rules
Owner-only recipes.