> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Table options

> Every option of table, series and timeline, and which kinds take it

A table is declared with `table(fields, options)`, `series(fields, options)`
or `timeline(fields, options)` and placed in the app tree, where its path is
its name. See [Tables](https://docs.bijection.com/database/tables.md) and
[Series and timelines](https://docs.bijection.com/database/series-and-timelines.md) for how to use them.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { label, series, t, table, timeline } from "@bijectionhq/bijection";

export const finance = label();

export const machines = table({ name: t.string, site: t.string }, { index: [["site", "name"]] });
export const settings = table({ site: t.string, mode: t.one("eco", "full") }, { key: ["site"] });
export const readings = series(
  { machine: t.key(machines), celsius: t.number },
  { key: ["machine"], mark: { minutes: 1 }, lifetime: { days: 400 } },
);
export const prices = timeline({ sku: t.string, amount: t.decimal }, { key: ["sku"], label: finance });
```

## Kinds

| Declaration | A row is | Key |
| - | - | - |
| `table` | One row per key | `key`, or minted by the host when absent |
| `series` | One sample per key and instant; it holds only at its instant, read as `at` | `key` is required |
| `timeline` | One fact per key and valid period; it holds from `from` until `to` | `key` is required |

`key` names one to four fields. Fields are declared with
[value types](https://docs.bijection.com/database/types.md); no field holds the time of a series sample
or a timeline period, which is the row's place, given by `.at(instant)` or
`.over({ from, to })`.

## Options by kind

| Option | Meaning | `table` | `series` | `timeline` |
| - | - | - | - | - |
| `key` | The fields that identify a row | Optional | Required | Required |
| `label` | The rows' label: a label, a label family, or `family.and(label)` | Yes | Yes | Yes |
| `unique` | Field sets unique within a Place. `{ fields, scope, release }` declares a family-stem claim and its verdict Release | Yes | Yes | Yes |
| `index` | Field orders that serve selections, unnamed and [matched by structure](https://docs.bijection.com/database/indexes.md). `{ fields, across, release }`: `release` keeps a [protected table](https://docs.bijection.com/database/protected-tables.md)'s order clear through a public release | Yes | Yes (no geometry) | Yes (no geometry) |
| `history` | How long superseded versions and their changes stay readable | Yes | Yes | Yes |
| `lifetime` | How long after it is written a fact is erased | Yes | Yes | Yes |
| `erasable` | Each row is its own erasure unit, for `ctx.erase` | With a minted key | No (the key is declared) | No (the key is declared) |
| `presence` | `{ label, field, release }`: where a row's existence is known, below `label` | Yes | Yes | Yes |
| `total` | `[{ group, sum, retained }]`: counts and exact sums the host maintains | Yes | No | No |
| `machine` | `{ field, initial, edge, undeclared, history }`: the states and named edges of one field | Yes | No | No |
| `pin` | `{ field, lifetime, quota }`: a version or branch field each write keeps readable | Yes | No | No |
| `mark` | The width of the valid-time buckets the host marks on every write | No | Yes | Yes |

Durations are `Temporal.Duration` values or duration literals such as
`{ days: 30 }`. `presence`, `total`, `machine`, `pin` and `mark` are
described in [Table capabilities](https://docs.bijection.com/database/capabilities.md).

## Limits and refusals

| Rule | Value |
| - | - |
| Key fields | 1 to 4 |
| Totals per table | At most 8, each grouping by at most 4 fields and summing at most 4 |
| `mark` | 1 second to 1 day, in whole milliseconds |
| `pin.lifetime` | 1 to 365 whole days (default 30); `pin.quota` 1 to 256 live pins (default 16) |
| Reserved fields | `id` on every kind; `at` on a series and on a `table` with a declared key; `from`, `to`, `validFrom` and `validTo` on a timeline; `member` in a family-labelled table |

A declaration names its fix when it refuses an option:

* `ErasableKeyMinted`: an erasable table's key is minted, so drop `key`.
* `SealedKey`, `SealedIndex`: a field sealed with `label.seal(type)` is never
  in the key or an ordered index.
* `StoreClearOverUnit` refuses a store exposure over data that erasure or expiry can close.
* `ExposureNotProtected` refuses an exposure of an order that is already structural.
* `ExposureAboveCeiling` requires the deployer's live grants to clear every label outcome of a table with a store exposure.
* `SharedClaimReleaseMissing` requires a Release for the verdict of
  `unique: [{ fields, scope: family.all, release }]`. Use a plain field
  list to keep the constraint within one Place.
* `MarkTimed`: only a series or a timeline takes `mark`.
* `SpatialTable`: only a `table` keeps a spatial index over a
  `t.geometry` field.
* `PresenceAbove`, `PresenceRelease`: `presence` needs a `label` above it,
  and its `release` lowers exactly the listed fields.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.