Index¶
Defines an index on a table
Properties¶
| Property | Type | Required | Description |
|---|---|---|---|
name |
string |
— | The index name. |
sql |
string |
— | User-provided raw SQL snippet. |
unique |
boolean |
— | Specifies that the index is a unique index. Default: false. |
recurse |
boolean |
— | Used to specify that the index should be created on partitions of the table. |
method |
brin | btree | gin | gist | hash | spgist |
— | The name of the index method to be used. Default: "btree". |
columns |
array of object |
— | Defines the columns that are indexed. |
include |
array of string |
— | Use to provide a list of non-key columns to provide in the index. |
storage_parameters |
object |
— | Storage parameter settings for the index. |
tablespace |
string |
— | Specifies the tablespace to use when creating the index. |
nulls_not_distinct |
boolean |
— | Renders NULLS NOT DISTINCT on a unique index (PostgreSQL 15+), where one null equals another. Absent means nulls are distinct, the default. |
where |
string |
— | Use to provide an expression for creating a partial index. |
comment |
string |
— | An optional comment about the table. |
dependencies |
dependencies | — | Database objects this object is dependent upon. |
columns[]¶
| Property | Type | Required | Description |
|---|---|---|---|
name |
string |
— | Specify either the column name, mutally exclusive from expression. |
expression |
string |
— | Specify an expression for the column, mutally exclusive from name. |
collation |
string |
— | Assigns a collation to the column (which must be of a collatable data type). If not specified, the column data type's default collation is used. |
opclass |
string |
— | The name of an operator class. |
direction |
ASC | DESC |
— | Specifies the sort direction in the index for the column. Default: "ASC". |
null_placement |
FIRST | LAST |
— | Specifies the placement of null values in the index. |
Mutually exclusive forms¶
Exactly one of these must hold:
name, withoutexpressionexpression, withoutname
Mutually exclusive forms¶
Exactly one of these must hold:
sql, withoutnameormethodorcolumnsorstorage_parametersoruniqueorrecurseorincludeorwherenameandcolumns, withoutsql
No other properties are accepted.
Source: schemata/index.yml · Resolved JSON Schema: index.json