Type Alias: Schema
Schema =
object
Defined in: cfds/base/schema.ts:121
A Schema defines the structure of a Document. Schemas are also versioned, allowing for live, gradual migrations of data for some users, while others continue to work with the old version in parallel.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
fields | SchemaFieldsDef | A definition of all fields declared by this schema. | cfds/base/schema.ts:135 |
ns | null | string | The namespace of this schema. The null and session namespaces are reserved for the GoatDB's use. | cfds/base/schema.ts:126 |
upgrade? | (data, schema) => CoreObject | An optional upgrade function, used to migrate documents from an older schema to this schema. When upgrading a document, upgrade functions are run in order until reaching the latest version available. For example, if a document is at schema v1, and needs to be upgraded to v3, then first the upgrade function of v2 will be run, then the result piped through the upgrade function of v3. | cfds/base/schema.ts:154 |
version | number | The version of this schema. Used to detect when a new version of a schema is available. | cfds/base/schema.ts:131 |