IndexAttributes

type IndexAttributes = string[] | string;

Specifies the attributes of an index. Accepts an Array of strings where each element is the name of an attribute of the same Model. If the index is on a single attribute, its name can be provided as a string instead of an Array.

IndexDefinition

type IndexDefinition = IndexAttributes | IndexOptions;

Defines an index, it can be either an IndexAttributes or an IndexOptions. If an IndexAttributes is used, the default value is used for all the not specified IndexOptions attributes.

IndexOptions

interface IndexOptions {
    attributes: IndexAttributes;
    type?: "btree" | "hash";
    unique?: boolean;
}

Specifies the options of an index.

IndexOptions.attributes

  • required

Defines the attribures of the index. See IndexAttributes for details.

IndexOptions.type

  • default: "btree"

Defines the type of the index. Accepted values are: "btree" and "hash".

IndexOptions.unique

  • default: false

Defines if the index must be a unique index or not.

IndexesDefinition

type IndexesDefinition = { [key: string]: IndexDefinition };

Specifies the indexes on the table ralitve to the Model. It is an Object where each key is the name of the index and the relative IndexDefinition value is the definition of the index.