Top Description Fields Constructors Methods
liquibase.change.core

public Class AddAutoIncrementChange

extends AbstractChange
Class Inheritance
Annotations
@DatabaseChange
name:addAutoIncrement
description:Converts an existing column to be an auto-increment (a.k.a \'identity\') column
priority:1
appliesTo:column
databaseNotes:@liquibase.change.DatabaseChangeNote(database="sqlite", notes="If the column type is not INTEGER it is converted to INTEGER")
Imports
java.math.BigInteger, java.util.Locale, liquibase.change.AbstractChange, .ChangeMetaData, .ChangeStatus, .DatabaseChange, .DatabaseChangeNote, .DatabaseChangeProperty, liquibase.database.Database, liquibase.database.core.PostgresDatabase, liquibase.exception.DatabaseException, liquibase.snapshot.InvalidExampleException, .SnapshotGeneratorFactory, liquibase.statement.SequenceNextValueFunction, .SqlStatement, liquibase.statement.core.AddAutoIncrementStatement, .AddDefaultValueStatement, .CreateSequenceStatement, .SetNullableStatement, liquibase.structure.core.Column, .Table

Makes an existing column into an auto-increment column. This change is only valid for databases with auto-increment/identity columns. The current version does not support MS-SQL.

Field Summary

Modifier and TypeField and Description
private String
private String
private String
private Boolean
private String
private BigInteger
private String
private BigInteger
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.

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
public String
public String
public String
getConfirmationMessage()

Implements liquibase.change.Change.getConfirmationMessage.

Confirmation message to be displayed after the change is executed.

public Boolean
public String
public BigInteger
public String
public String
public BigInteger
public String
public void
setCatalogName(String catalogName)

public void
setColumnDataType(String columnDataType)

public void
setColumnName(String columnName)

public void
setDefaultOnNull(Boolean defaultOnNull)

public void
setGenerationType(String generationType)

public void
public void
setSchemaName(String schemaName)

public void
public void
setTableName(String tableName)

Inherited from liquibase.change.AbstractChange:
createChangeMetaDatacreateChangeParameterMetadatacreateDescriptionMetaDatacreateEmptyColumnConfigcreateExampleValueMetaDatacreateInversescreateMustEqualExistingMetaDatacreateRequiredDatabasesMetaDatacreateSerializationTypeMetaDatacreateSinceMetaDatacreateSupportedDatabasesMetaDatacustomLoadLogicequalsfinishInitializationgenerateCheckSumgenerateRollbackStatementsgenerateRollbackStatementsVolatilegenerateStatementsVolatilegetAffectedDatabaseObjectsgetChangeSetgetDescriptiongetExcludedFieldFiltersgetResourceAccessorgetSerializableFieldNamespacegetSerializableFieldsgetSerializableFieldTypegetSerializableFieldValuegetSerializedObjectNamehashCodeisInvalidPropertyloadmodifyserializeserializeValuesetChangeSetsetResourceAccessorshouldExecuteChangesupportssupportsRollbacktoStringvalidatewarn

Field Detail

catalogNameback to summary
private String catalogName
columnDataTypeback to summary
private String columnDataType
columnNameback to summary
private String columnName
defaultOnNullback to summary
private Boolean defaultOnNull
generationTypeback to summary
private String generationType
incrementByback to summary
private BigInteger incrementBy
schemaNameback to summary
private String schemaName
startWithback to summary
private BigInteger startWith
tableNameback to summary
private String tableName

Constructor Detail

AddAutoIncrementChangeback to summary
public AddAutoIncrementChange()

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
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
getCatalogNameback to summary
public String getCatalogName()
Annotations
@DatabaseChangeProperty
since:3.0
mustEqualExisting:column.relation.catalog
description:Name of the database catalog
getColumnDataTypeback to summary
public String getColumnDataType()
Annotations
@DatabaseChangeProperty
exampleValue:int
description:Current data type of the column to make auto-increment
getColumnNameback to summary
public String getColumnName()
Annotations
@DatabaseChangeProperty
mustEqualExisting:column
description:Name of the column
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
getDefaultOnNullback to summary
public Boolean getDefaultOnNull()
Annotations
@DatabaseChangeProperty
exampleValue:true
since:3.6
description:When using generationType of BY DEFAULT then defaultOnNull=true allows the identity to be used if the identity column is referenced, but a value of NULL is specified.
getGenerationTypeback to summary
public String getGenerationType()
Annotations
@DatabaseChangeProperty
exampleValue:ALWAYS
since:3.6
description:Type of the generation in "GENERATED %s AS IDENTITY". Default: "|".
getIncrementByback to summary
public BigInteger getIncrementBy()
Annotations
@DatabaseChangeProperty
exampleValue:1
description:Amount to increment by at each call
getSchemaNameback to summary
public String getSchemaName()
Annotations
@DatabaseChangeProperty
mustEqualExisting:column.relation.schema
description:Name of the database schema
getSerializedObjectNamespaceback to summary
public String getSerializedObjectNamespace()

Overrides liquibase.change.AbstractChange.getSerializedObjectNamespace.

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectNamespace.

Annotations
@Override
getStartWithback to summary
public BigInteger getStartWith()
Annotations
@DatabaseChangeProperty
exampleValue:100
description:Initial value of the increment
getTableNameback to summary
public String getTableName()
Annotations
@DatabaseChangeProperty
mustEqualExisting:column.relation
description:Name of the table
setCatalogNameback to summary
public void setCatalogName(String catalogName)
setColumnDataTypeback to summary
public void setColumnDataType(String columnDataType)
setColumnNameback to summary
public void setColumnName(String columnName)
setDefaultOnNullback to summary
public void setDefaultOnNull(Boolean defaultOnNull)
setGenerationTypeback to summary
public void setGenerationType(String generationType)
setIncrementByback to summary
public void setIncrementBy(BigInteger incrementBy)
setSchemaNameback to summary
public void setSchemaName(String schemaName)
setStartWithback to summary
public void setStartWith(BigInteger startWith)
setTableNameback to summary
public void setTableName(String tableName)