TableSchema

tcmts.core.schema.TableSchema · #mo6d2mqv · type

A table's row type, as a schema, with a hash identifying it (rows record the hash they were written with).

import type { Schema } from "#codebase/tcmts/core/schema";

export interface TableSchema {
  /** the table's name, if given as a literal */
  name?: string;
  /** whether the definition passes options (a `migrate` function) */
  hasOptions?: boolean;
  hash: string;
  s: Schema;
  defs: Schema[];
  /**
   * the parameter type of each `migrate` step, in order (one for a single function): a stored row goes through
   * the first step whose parameter it fits, then the later ones, until it fits the row type
   */
  steps?: { s: Schema; defs: Schema[] }[];
  /** fields no two rows may share */
  unique?: string[];
  /** fields with an index, for `find` */
  index?: string[];
  /** the table's previous name: its rows move to this one */
  renamedFrom?: string;
}

uses

used by