entity(name, fields, options).
id (ULID string) and the column order you declared.
Field types
| Method | Type | Notes |
|---|---|---|
field.string() | TEXT | Any UTF-8 string |
field.int() | INTEGER | 64-bit signed |
field.float() | REAL | 64-bit IEEE-754 |
field.boolean() | INTEGER (0/1) | |
field.datetime() | TEXT (ISO-8601) | Store with new Date().toISOString() |
field.richtext() | TEXT | For prose; the client SDK has editors ready |
field.id(entity) | TEXT | Foreign key to another entity’s id |
Modifiers
.optional()— column is nullable.unique()— adds a unique index on that one column
Indexes
Declare composite or non-unique indexes in the options block:Relationships
Pylon doesn’t have a separate relation primitive — usefield.id("Other") and query with filters. The typed client db.query("Message", { roomId }) narrows by indexed columns.
Schema changes
Editapp.ts, save — pylon dev picks up the change and runs a live migration. Pylon’s storage layer plans the diff (add column, drop index, etc.) and applies it to your database, whether SQLite or Postgres. Destructive operations (dropping a column that has data) require you to bump manifest.version.
Next
Policies
Control who can read and write each row.
Functions
Write server-side logic.