Top Description Fields Constructors Methods
liquibase.change.core

public Class CreateIndexChange

extends AbstractChange
implements ChangeWithColumns<AddColumnConfig>
Class Inheritance
All Implemented Interfaces
liquibase.change.ChangeWithColumns
Annotations
@DatabaseChange
name:createIndex
description:Creates an index on an existing column or set of columns.
priority:1
appliesTo:index
Imports
liquibase.ChecksumVersion, liquibase.change.*, liquibase.database.Database, liquibase.exception.ValidationErrors, liquibase.snapshot.SnapshotGeneratorFactory, liquibase.statement.SqlStatement, liquibase.statement.core.CreateIndexStatement, liquibase.structure.core.Column, .Index, java.util.ArrayList, .Collection, .List

Creates an index on an existing column.

Field Summary

Modifier and TypeField and Description
private String
private String
private Boolean
private List<AddColumnConfig>
private String
private String
private String
private String
private Boolean
Inherited from liquibase.change.AbstractChange:
NODENAME_COLUMN

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addColumn(AddColumnConfig column)

Implements liquibase.change.ChangeWithColumns.addColumn.

Add a column configuration to the Change.

public ChangeStatus
checkStatus(Database database)

Overrides liquibase.change.AbstractChange.checkStatus.

Implements liquibase.change.Change.checkStatus.

Validate that this change executed successfully against the given database.

protected Change[]
createInverses()

Overrides liquibase.change.AbstractChange.createInverses.

Create inverse changes that can roll back this change.

public SqlStatement[]
generateStatements(Database database)

Implements liquibase.change.Change.generateStatements.

Generates the SqlStatement objects required to run the change for the given database.

public String

Returns:

Index associations. Valid values:
  • primaryKey
  • foreignKey
  • uniqueConstraint
  • none
  • getAssociatedWith
    ()

    public String
    public Boolean
    public List<AddColumnConfig>
    getColumns()

    Implements liquibase.change.ChangeWithColumns.getColumns.

    Return all the ColumnConfig objects defined for this Change

    public String
    getConfirmationMessage()

    Implements liquibase.change.Change.getConfirmationMessage.

    Confirmation message to be displayed after the change is executed.

    public String[]
    public String
    public String
    public Object
    public String
    public String
    public String
    public Boolean
    public void
    setAssociatedWith(String associatedWith)

    public void
    setCatalogName(String catalogName)

    public void
    setClustered(Boolean clustered)

    public void
    public void
    setIndexName(String indexName)

    public void
    setSchemaName(String schemaName)

    public void
    setTableName(String tableName)

    public void
    setTablespace(String tablespace)

    public void
    setUnique(Boolean
    the isUnique to set
    isUnique
    )

    public ValidationErrors
    validate(Database database)

    Overrides liquibase.change.AbstractChange.validate.

    Implements liquibase.change.Change.validate.

    Implementation checks the ChangeParameterMetaData for declared required fields and also delegates logic to the liquibase.sqlgenerator.SqlGenerator#validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by generateStatements.

    Inherited from liquibase.change.AbstractChange:
    createChangeMetaDatacreateChangeParameterMetadatacreateDescriptionMetaDatacreateEmptyColumnConfigcreateExampleValueMetaDatacreateMustEqualExistingMetaDatacreateRequiredDatabasesMetaDatacreateSerializationTypeMetaDatacreateSinceMetaDatacreateSupportedDatabasesMetaDatacustomLoadLogicequalsfinishInitializationgenerateCheckSumgenerateRollbackStatementsgenerateRollbackStatementsVolatilegenerateStatementsVolatilegetAffectedDatabaseObjectsgetChangeSetgetDescriptiongetResourceAccessorgetSerializableFieldNamespacegetSerializableFieldsgetSerializableFieldTypegetSerializedObjectNamehashCodeisInvalidPropertyloadmodifyserializeserializeValuesetChangeSetsetResourceAccessorshouldExecuteChangesupportssupportsRollbacktoStringwarn

    Field Detail

    associatedWithback to summary
    private String associatedWith
    catalogNameback to summary
    private String catalogName
    clusteredback to summary
    private Boolean clustered
    columnsback to summary
    private List<AddColumnConfig> columns
    indexNameback to summary
    private String indexName
    schemaNameback to summary
    private String schemaName
    tableNameback to summary
    private String tableName
    tablespaceback to summary
    private String tablespace
    uniqueback to summary
    private Boolean unique

    Constructor Detail

    CreateIndexChangeback to summary
    public CreateIndexChange()

    Method Detail

    addColumnback to summary
    public void addColumn(AddColumnConfig column)

    Implements liquibase.change.ChangeWithColumns.addColumn.

    Doc from liquibase.change.ChangeWithColumns.addColumn.

    Add a column configuration to the Change.

    Annotations
    @Override
    checkStatusback to summary
    public ChangeStatus checkStatus(Database database)

    Overrides liquibase.change.AbstractChange.checkStatus.

    Implements liquibase.change.Change.checkStatus.

    Doc from liquibase.change.Change.checkStatus.

    Validate that this change executed successfully against the given database. This will check that the update completed at a high level plus check details of the change. For example, a change to add a column will check that the column exists plus data type, default values, etc.

    Annotations
    @Override
    createInversesback to summary
    protected Change[] createInverses()

    Overrides liquibase.change.AbstractChange.createInverses.

    Doc from liquibase.change.AbstractChange.createInverses.

    Create inverse changes that can roll back this change. This method is intended to be overridden by Change implementations that have a logical inverse operation. Default implementation returns null.

    If generateRollbackStatements(liquibase.database.Database) is overridden, this method may not be called.

    Returns:Change[]

    Return null if there is no corresponding inverse and therefore automatic rollback is not possible. Return an empty array to have a no-op rollback.

    Annotations
    @Override
    generateStatementsback to summary
    public SqlStatement[] generateStatements(Database database)

    Implements liquibase.change.Change.generateStatements.

    Doc from liquibase.change.Change.generateStatements.

    Generates the SqlStatement objects required to run the change for the given database.

    NOTE: This method may be called multiple times throughout the changelog execution process and may be called in documentation generation and other integration points as well.

    If this method reads from the current database state or uses any other logic that will be affected by whether previous changeSets have ran or not, you must return true from generateStatementsVolatile.
    Annotations
    @Override
    getAssociatedWithback to summary
    public String getAssociatedWith()
    Returns:String

    Index associations. Valid values:

  • primaryKey
  • foreignKey
  • uniqueConstraint
  • none
  • Annotations
    @DatabaseChangeProperty
    description:Index associations. Valid values: primaryKey, foreignKey, uniqueConstriant, none
    getCatalogNameback to summary
    public String getCatalogName()
    Annotations
    @DatabaseChangeProperty
    since:3.0
    description:Name of the database catalog
    getClusteredback to summary
    public Boolean getClustered()
    Annotations
    @DatabaseChangeProperty
    description:Whether to create a clustered index
    getColumnsback to summary
    public List<AddColumnConfig> getColumns()

    Implements liquibase.change.ChangeWithColumns.getColumns.

    Doc from liquibase.change.ChangeWithColumns.getColumns.

    Return all the ColumnConfig objects defined for this Change

    Annotations
    @Override
    @DatabaseChangeProperty
    mustEqualExisting:index.column
    description:Column(s) in the table to add the index on
    requiredForDatabase:all
    getConfirmationMessageback to summary
    public String getConfirmationMessage()

    Implements liquibase.change.Change.getConfirmationMessage.

    Doc from liquibase.change.Change.getConfirmationMessage.

    Confirmation message to be displayed after the change is executed. Should include relevant configuration settings to make it as helpful as possible. This method may be called outside the changelog execution process, such as in documentation generation.

    Annotations
    @Override
    getExcludedFieldFiltersback to summary
    public String[] getExcludedFieldFilters(ChecksumVersion version)

    Overrides liquibase.change.AbstractChange.getExcludedFieldFilters.

    Annotations
    @Override
    getIndexNameback to summary
    public String getIndexName()
    Annotations
    @DatabaseChangeProperty
    mustEqualExisting:index
    description:Name of the index to create
    getSchemaNameback to summary
    public String getSchemaName()
    Annotations
    @DatabaseChangeProperty
    mustEqualExisting:index.schema
    description:Name of the database schema
    getSerializableFieldValueback to summary
    public Object getSerializableFieldValue(String field)

    Overrides liquibase.change.AbstractChange.getSerializableFieldValue.

    Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldValue.

    Annotations
    @Override
    getSerializedObjectNamespaceback to summary
    public String getSerializedObjectNamespace()

    Overrides liquibase.change.AbstractChange.getSerializedObjectNamespace.

    Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectNamespace.

    Annotations
    @Override
    getTableNameback to summary
    public String getTableName()
    Annotations
    @DatabaseChangeProperty
    mustEqualExisting:index.table
    description:Name of the table to add the index on
    exampleValue:person
    getTablespaceback to summary
    public String getTablespace()
    Annotations
    @DatabaseChangeProperty
    description:Tablepace to create the index in. Corresponds to file group in mssql
    isUniqueback to summary
    public Boolean isUnique()
    Annotations
    @DatabaseChangeProperty
    description:Whether the index is unique (contains no duplicate values)
    since:1.8
    setAssociatedWithback to summary
    public void setAssociatedWith(String associatedWith)
    setCatalogNameback to summary
    public void setCatalogName(String catalogName)
    setClusteredback to summary
    public void setClustered(Boolean clustered)
    setColumnsback to summary
    public void setColumns(List<AddColumnConfig> columns)

    Implements liquibase.change.ChangeWithColumns.setColumns.

    Annotations
    @Override
    setIndexNameback to summary
    public void setIndexName(String indexName)
    setSchemaNameback to summary
    public void setSchemaName(String schemaName)
    setTableNameback to summary
    public void setTableName(String tableName)
    setTablespaceback to summary
    public void setTablespace(String tablespace)
    setUniqueback to summary
    public void setUnique(Boolean isUnique)
    Parameters
    isUnique:Boolean

    the isUnique to set

    validateback to summary
    public ValidationErrors validate(Database database)

    Overrides liquibase.change.AbstractChange.validate.

    Implements liquibase.change.Change.validate.

    Doc from liquibase.change.AbstractChange.validate.

    Implementation checks the ChangeParameterMetaData for declared required fields and also delegates logic to the liquibase.sqlgenerator.SqlGenerator#validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by generateStatements. If no or null SqlStatements are returned by generateStatements then this method returns no errors. If there are no parameters than this method returns no errors

    Annotations
    @Override