Creates an index on an existing column or set of columns.
| Name | Description |
|---|---|
| catalogName | Name of the catalog@ v3.0E.g. 'cat' |
| clustered | booleanCreate clustered index. |
| indexName | Name of the index to createE.g. 'idx_address'Required for: firebird, hsqldb |
| schemaName | Name of the schemaE.g. 'public' |
| tableName | Name of the table to add the index toE.g. 'person' |
| tablespace | Tablespace to create the index in.E.g. 'A String' |
| unique | booleanUnique values index@ v1.8 |
| Name | Description | ||||||
|---|---|---|---|---|---|---|---|
| columns / column [1..N] | Column(s) to add to the indexNote: columns tag not required in XML Attributes
|
<changeSet author="liquibase-docs" id="createIndex-example">
<createIndex catalogName="cat"
clustered="true"
indexName="idx_address"
schemaName="public"
tableName="person"
tablespace="A String"
unique="true">
<column descending="true" name="address"/>
</createIndex>
</changeSet>changeSet:
id: createIndex-example
author: liquibase-docs
changes:
- createIndex:
catalogName: cat
clustered: true
columns:
- column:
descending: true
name: address
indexName: idx_address
schemaName: public
tableName: person
tablespace: A String
unique: true{
"changeSet": {
"id": "createIndex-example",
"author": "liquibase-docs",
"changes": [
{
"createIndex": {
"catalogName": "cat",
"clustered": true,
"columns": [
{
"column": {
"descending": true,
"name": "address"
}
}]
,
"indexName": "idx_address",
"schemaName": "public",
"tableName": "person",
"tablespace": "A String",
"unique": true
}
}]
}
}CREATE UNIQUE INDEX idx_address ON cat.person(address DESC);| Database | Notes | Auto Rollback |
|---|---|---|
| DB2/LUW | Supported | Yes |
| DB2/z | Supported | Yes |
| Derby | Supported | Yes |
| Firebird | Supported | Yes |
| H2 | Supported | Yes |
| HyperSQL | Supported | Yes |
| INGRES | Supported | Yes |
| Informix | Supported | Yes |
| MariaDB | Supported | Yes |
| MySQL | Supported | Yes |
| Oracle | Supported | Yes |
| PostgreSQL | Supported | Yes |
| SQL Server | Supported | Yes |
| SQLite | Supported | Yes |
| Sybase | Supported | Yes |
| Sybase Anywhere | Supported | Yes |