Top Description Fields Constructors Methods
liquibase.change.core

public Class AddLookupTableChange

extends AbstractChange
Class Inheritance
Annotations
@DatabaseChange
name:addLookupTable
priority:1
appliesTo:column
description:Creates a lookup table containing values stored in a column and creates a foreign key to the new table.
Imports
java.util.ArrayList, .Arrays, .List, liquibase.Scope, liquibase.change.*, liquibase.database.Database, liquibase.database.core.DB2Database, .Db2zDatabase, .HsqlDatabase, .InformixDatabase, .MSSQLDatabase, .OracleDatabase, .SybaseASADatabase, liquibase.datatype.DataTypeFactory, liquibase.exception.ValidationErrors, liquibase.snapshot.SnapshotGeneratorFactory, liquibase.statement.NotNullConstraint, .SqlStatement, liquibase.statement.core.CreateTableStatement, .RawSqlStatement, .ReorganizeTableStatement, liquibase.structure.core.Column, .ForeignKey, .Table

Extracts data from an existing column to create a lookup table. A foreign key is created between the old column and the new lookup table.

Field Summary

Modifier and TypeField and Description
private String
private String
private String
private String
private String
private String
private String
private String
private String
private String
Inherited from liquibase.change.AbstractChange:
NODENAME_COLUMN

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
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
getConfirmationMessage()

Implements liquibase.change.Change.getConfirmationMessage.

Confirmation message to be displayed after the change is executed.

public String
public String
public String
public String
public String
public String
public String
public String
public String
public String
public String
public String
public void
setConstraintName(String constraintName)

public void
setExistingColumnName(String existingColumnName)

public void
setExistingTableCatalogName(String existingTableCatalogName)

public void
setExistingTableName(String existingTableName)

public void
setExistingTableSchemaName(String existingTableSchemaName)

public void
setNewColumnDataType(String newColumnDataType)

public void
setNewColumnName(String newColumnName)

public void
setNewTableCatalogName(String newTableCatalogName)

public void
setNewTableName(String newTableName)

public void
setNewTableSchemaName(String newTableSchemaName)

public boolean
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:
createChangeMetaDatacreateChangeParameterMetadatacreateDescriptionMetaDatacreateEmptyColumnConfigcreateExampleValueMetaDatacreateMustEqualExistingMetaDatacreateRequiredDatabasesMetaDatacreateSerializationTypeMetaDatacreateSinceMetaDatacreateSupportedDatabasesMetaDatacustomLoadLogicequalsfinishInitializationgenerateCheckSumgenerateRollbackStatementsgenerateRollbackStatementsVolatilegenerateStatementsVolatilegetAffectedDatabaseObjectsgetChangeSetgetDescriptiongetExcludedFieldFiltersgetResourceAccessorgetSerializableFieldNamespacegetSerializableFieldsgetSerializableFieldTypegetSerializableFieldValuegetSerializedObjectNamehashCodeisInvalidPropertyloadmodifyserializeserializeValuesetChangeSetsetResourceAccessorshouldExecuteChangesupportsRollbacktoStringwarn

Field Detail

constraintNameback to summary
private String constraintName
existingColumnNameback to summary
private String existingColumnName
existingTableCatalogNameback to summary
private String existingTableCatalogName
existingTableNameback to summary
private String existingTableName
existingTableSchemaNameback to summary
private String existingTableSchemaName
newColumnDataTypeback to summary
private String newColumnDataType
newColumnNameback to summary
private String newColumnName
newTableCatalogNameback to summary
private String newTableCatalogName
newTableNameback to summary
private String newTableName
newTableSchemaNameback to summary
private String newTableSchemaName

Constructor Detail

AddLookupTableChangeback to summary
public AddLookupTableChange()

Method Detail

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
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
getConstraintNameback to summary
public String getConstraintName()
Annotations
@DatabaseChangeProperty
description:Name of the foreign key constraint to create between the existing table and the lookup table
exampleValue:fk_address_state
getExistingColumnNameback to summary
public String getExistingColumnName()
Annotations
@DatabaseChangeProperty
mustEqualExisting:column
description:Name of the column containing the data to extract
exampleValue:state
getExistingTableCatalogNameback to summary
public String getExistingTableCatalogName()
Annotations
@DatabaseChangeProperty
description:Name of the database catalog of the existing table
getExistingTableNameback to summary
public String getExistingTableName()
Annotations
@DatabaseChangeProperty
mustEqualExisting:column.relation
description:Name of the table containing the data to extract
exampleValue:address
getExistingTableSchemaNameback to summary
public String getExistingTableSchemaName()
Annotations
@DatabaseChangeProperty
mustEqualExisting:column.relation.schema
description:Name of the database schema where the table containing data to extract resides
getFinalConstraintNameback to summary
public String getFinalConstraintName()
getNewColumnDataTypeback to summary
public String getNewColumnDataType()
Annotations
@DatabaseChangeProperty
description:Data type of the new table column
exampleValue:char(2)
getNewColumnNameback to summary
public String getNewColumnName()
Annotations
@DatabaseChangeProperty
description:Name of the column in the new table to create
exampleValue:abbreviation
getNewTableCatalogNameback to summary
public String getNewTableCatalogName()
Annotations
@DatabaseChangeProperty
since:3.0
description:Name of the database catalog for the lookup table
getNewTableNameback to summary
public String getNewTableName()
Annotations
@DatabaseChangeProperty
description:Name of lookup table to create
exampleValue:state
getNewTableSchemaNameback to summary
public String getNewTableSchemaName()
Annotations
@DatabaseChangeProperty
description:Name of the database schema for the lookup table
getSerializedObjectNamespaceback to summary
public String getSerializedObjectNamespace()

Overrides liquibase.change.AbstractChange.getSerializedObjectNamespace.

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectNamespace.

Annotations
@Override
setConstraintNameback to summary
public void setConstraintName(String constraintName)
setExistingColumnNameback to summary
public void setExistingColumnName(String existingColumnName)
setExistingTableCatalogNameback to summary
public void setExistingTableCatalogName(String existingTableCatalogName)
setExistingTableNameback to summary
public void setExistingTableName(String existingTableName)
setExistingTableSchemaNameback to summary
public void setExistingTableSchemaName(String existingTableSchemaName)
setNewColumnDataTypeback to summary
public void setNewColumnDataType(String newColumnDataType)
setNewColumnNameback to summary
public void setNewColumnName(String newColumnName)
setNewTableCatalogNameback to summary
public void setNewTableCatalogName(String newTableCatalogName)
setNewTableNameback to summary
public void setNewTableName(String newTableName)
setNewTableSchemaNameback to summary
public void setNewTableSchemaName(String newTableSchemaName)
supportsback to summary
public boolean supports(Database database)

Overrides liquibase.change.AbstractChange.supports.

Implements liquibase.change.Change.supports.

Doc from liquibase.change.AbstractChange.supports.

Implementation delegates logic to the liquibase.sqlgenerator.SqlGenerator#supports(liquibase.statement.SqlStatement, liquibase.database.Database) method on the SqlStatement objects returned by generateStatements. If no or null SqlStatements are returned by generateStatements then this method returns true. If generateStatementsVolatile(liquibase.database.Database) returns true, we cannot call generateStatements and so assume true.

Annotations
@Override
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