Typed collections

Base collections

An authenticated administrator can create, inspect, list, change and delete collection metadata through the admin API and dashboard.

Create in the dashboard

Open Collections, name the collection, and use Add field for every field the schema needs. Each row defines its name, type, required state and uniqueness. Trestle creates the whole collection in one operation. The unfinished draft is kept in the browser while you visit other dashboard sections or reload the page, and is cleared only after successful creation.

Admin API

GET    /admin/v1/collections
POST   /admin/v1/collections
GET    /admin/v1/collections/{name}
PATCH  /admin/v1/collections/{name}
DELETE /admin/v1/collections/{name}

Reads require a live administrator session. Mutations additionally require the current session's X-Trestle-CSRF token and same-origin request.

Create metadata

{
  "name": "issues",
  "fields": [
    {"name":"title","type":"text","required":true,"unique":false},
    {"name":"priority","type":"number","required":false,"unique":false}
  ]
}

Keys and relations

Every physical collection table has a generated _id TEXT PRIMARY KEY. SQLite foreign-key enforcement is enabled for every connection. Relation fields currently store record IDs as text; target-collection and delete/update policy metadata will be required before Trestle can generate physical foreign-key constraints for them.