TinyBase logoTinyBase

TablesSchema

{[tableId: Id]: {[cellId: Id]: CellSchema}}

A TablesSchema comprises a JavaScript object describing each Table, in turn a nested JavaScript object containing information about each Cell and its CellSchema. It is provided to the setTablesSchema method.

Example

When applied to a Store, this TablesSchema only allows one Table called pets, in which each Row may contain a string species Cell, and is guaranteed to contain a boolean sold Cell that defaults to false.

const tableSchema: TablesSchema = {
  pets: {
    species: {type: 'string'},
    sold: {type: 'boolean', default: false},
  },
};