TableOptions
tcmts.server.TableOptions · #l7twye72 · type
export interface TableOptions<T> {
/**
* Upgrades rows stored as an earlier row type. One function, or one step per earlier type, oldest first:
* `[fromV1, fromV2]`. A row goes through the first step whose parameter type it fits, then the later ones,
* until it fits `T`. The result is checked, and stored. `tcm data migrate <table>` upgrades every row now.
*/
migrate?: ((old: any) => T | Promise<T>) | readonly ((old: any) => unknown)[];
/** Fields no two rows may share: a write that would duplicate one fails with a 409. Indexed. */
unique?: readonly (keyof T & string)[];
/** Fields to index, so `find` on them doesn't read every row. */
index?: readonly (keyof T & string)[];
/** The table's previous name: its rows move to this table when it's first used. */
renamedFrom?: string;
}
used by