interface IndexOptions {
    concurrently?: boolean;
    fields?: (string | Fn | Literal | IndexField)[];
    include?: Literal | (string | Literal)[];
    msg?: string;
    name?: string;
    operator?: string;
    parser?: null | string;
    prefix?: string;
    type?: IndexType;
    unique?: boolean;
    using?: string;
    where?: WhereOptions;

Hierarchy (view full)


concurrently?: boolean

PostgreSQL will build the index without taking any write locks. Postgres only.


fields?: (string | Fn | Literal | IndexField)[]

The fields to index.

include?: Literal | (string | Literal)[]

Non-key columns to be added to the lead level of the nonclustered index.

msg?: string

The message to display if the unique constraint is violated.

name?: string

The name of the index. Defaults to model name + _ + fields concatenated

operator?: string

Index operator type. Postgres only

parser?: null | string

For FULLTEXT columns set your parser

prefix?: string

Prefix to append to the index name.

type?: IndexType

Index type. Only used by mysql. One of UNIQUE, FULLTEXT and SPATIAL

unique?: boolean

Should the index by unique? Can also be triggered by setting type to UNIQUE


using?: string

The method to create the index by (USING statement in SQL). BTREE and HASH are supported by mysql and postgres. Postgres additionally supports GIST, SPGIST, BRIN and GIN.

where?: WhereOptions

Optional where parameter for index. Can be used to limit the index to certain rows.