Overview
schema() compiles the tables into one catalog. Each option is a page.
export default schema({
tables: [notes],required …,sections});
Tables
The list, in the order you write it. A reference names a table in this list, earlier or later. table() only stores the columns. Names and the catalog hash are fixed here. Calling schema() twice on the same tables returns equal catalog bytes.
Pages
Each other field is a page in this group.
The declaration
Each option is a page. Tables come first, because every other option refers to them.
| Order | Page | You use it for |
|---|---|---|
| 1 | Tables | The list schema() compiles. |
| 2 | Casing | The SQL name of a camelCase field. |
| 3 | Codecs | The TypeScript value. The SQL type stays. |
| 4 | Row types | Emitted types, or types kept in the checker. |
| 5 | Id default | What a bare t.id() means. |
| 6 | Minimum Postgres | The oldest major. Omitted means 15. |
| 7 | Traits | Columns added to every table. |
| 8 | Tenancy | Tenant keys on every table. |
| 9 | Validation | Whether rules run. |
| 10 | Extensions | Extensions the catalog names. |
| 11 | Functions | Routines the catalog stores. |
| 12 | Triggers | Triggers that call those functions. |
| 13 | Views | Views and materialized views. |
| 14 | Several catalogs | external(), a snapshot, and one history per namespace. |