Entities, stores and migrations
How you declare the records your app keeps, where they are stored, and how their shape changes over time. Reading and changing records is Reads and writes; who may read or change one is Policy.
Examples use the golden todo app's planning domain, plus a shop where Redis
is needed.
| Entities and the id An entity is a kind of stored record with a lasting identity, like a table with types. |
| Fields and their settings A field's settings, such as |
| Unique rules
|
| References and on_delete Any field typed |
| Children A parent doesn't declare its children. |
| Lifecycle A lifecycle describes the stages a record goes through and when it drops out of normal view. |
| Stores A store is somewhere your app keeps records: a PostgreSQL database, or a Redis server. |
| Structured values A field whose type is one of your app's enums with data, objects, lists, sets or maps is kept in one |
| Storage types You never name a column type. |
| Indexes You don't write the indexes your queries need. |
| Migrations Entities describe the schema you want. |
| Computed backfills A backfill can be an expression over each row's own stored fields, so a migration can reshape data rather than only fill it with one value. |
| Seeds A seed creates data for development by calling your app's own actions, so validation, lifecycle and policy apply to it. |
| Entities in Redis not built An entity may live in a Redis store, for data that is short-lived and harmless to lose. |
| Where things live An entity's file holds only its data definition: its store, fields, unique rules, indexes, lifecycle, policy and record cache. |
What is built says which of this works today.
Details
The exact rules, for when you hit an edge case.
| System tables The runtime needs tables of its own, for example to hold events until they are delivered. |
Markdown for agents: /docs/data.md.Built from Jadpo main at aee2e8f.