Package liquibase.change
Class ConstraintsConfig
- java.lang.Object
-
- liquibase.serializer.AbstractLiquibaseSerializable
-
- liquibase.change.ConstraintsConfig
-
- All Implemented Interfaces:
LiquibaseSerializable
public class ConstraintsConfig extends AbstractLiquibaseSerializable
The standard configuration used by Change classes to represent a constraints on a column.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
-
-
Field Summary
-
Fields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
-
-
Constructor Summary
Constructors Constructor Description ConstraintsConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCheckConstraint()
Returns the check constraint to use on this column.String
getForeignKeyName()
Returns the name to use for the columns foreign key constraint.String
getNotNullConstraintName()
IfisNullable()
is 'false' and database supports named not null constraintsString
getPrimaryKeyName()
Returns the name to use for the primary key constraint.String
getPrimaryKeyTablespace()
Returns the tablespace to use for the defined primary key.String
getReferencedColumnNames()
String
getReferencedTableCatalogName()
String
getReferencedTableName()
String
getReferencedTableSchemaName()
String
getReferences()
Returns the "references" clause to use for the foreign key.String
getSerializedObjectName()
String
getSerializedObjectNamespace()
String
getUniqueConstraintName()
Returns the name to use for the unique constraint.Boolean
getValidateForeignKey()
Returns whether a ForeignKeyConst defined for this column should validate.Boolean
getValidateNullable()
Returns whether a NotNullConst defined for this column should validate.Boolean
getValidatePrimaryKey()
Returns whether a PrimaryKeyConst defined for this column should validate.Boolean
getValidateUnique()
Returns whether a UniqueConst defined for this column should validate.Boolean
isDeferrable()
Returns if a foreign key defined for this column should deferrable.Boolean
isDeleteCascade()
Returns if a foreign key defined for this column should cascade deletes.Boolean
isInitiallyDeferred()
Returns if a foreign key defined for this column should be "initially deferred".Boolean
isNullable()
Returns if the column should be nullable.Boolean
isPrimaryKey()
Returns true if the column should be part of the primary key.Boolean
isUnique()
Returns if the column is part of a unique constraint.void
load(ParsedNode parsedNode, ResourceAccessor resourceAccessor)
ConstraintsConfig
setCheckConstraint(String checkConstraint)
ConstraintsConfig
setDeferrable(Boolean deferrable)
ConstraintsConfig
setDeferrable(String deferrable)
Set the deferrable parameter based on the passed string.ConstraintsConfig
setDeleteCascade(Boolean deleteCascade)
ConstraintsConfig
setDeleteCascade(String deleteCascade)
Set the deleteCascade parameter based on the passed string.ConstraintsConfig
setForeignKeyName(String foreignKeyName)
ConstraintsConfig
setInitiallyDeferred(Boolean initiallyDeferred)
ConstraintsConfig
setInitiallyDeferred(String initiallyDeferred)
Set the initiallyDeferred parameter based on the passed string.ConstraintsConfig
setNotNullConstraintName(String notNullConstraintName)
ConstraintsConfig
setNullable(Boolean nullable)
ConstraintsConfig
setNullable(String nullable)
Set the nullable parameter based on the passed string.ConstraintsConfig
setPrimaryKey(Boolean primaryKey)
ConstraintsConfig
setPrimaryKey(String primaryKey)
Set the primaryKey parameter based on the passed string.ConstraintsConfig
setPrimaryKeyName(String primaryKeyName)
ConstraintsConfig
setPrimaryKeyTablespace(String primaryKeyTablespace)
void
setReferencedColumnNames(String referencedColumnNames)
void
setReferencedTableCatalogName(String referencedTableCatalogName)
void
setReferencedTableName(String referencedTableName)
void
setReferencedTableSchemaName(String referencedTableSchemaName)
ConstraintsConfig
setReferences(String references)
ConstraintsConfig
setUnique(Boolean unique)
ConstraintsConfig
setUnique(String unique)
Set the unique parameter based on the passed string.ConstraintsConfig
setUniqueConstraintName(String uniqueConstraintName)
ConstraintsConfig
setValidateForeignKey(Boolean validateForeignKey)
ConstraintsConfig
setValidateForeignKey(String validateForeignKey)
Set the validateForeignKey field based on the passed string.ConstraintsConfig
setValidateNullable(Boolean validateNullable)
ConstraintsConfig
setValidateNullable(String validateNullable)
Set the validateNullable field based on the passed string.ConstraintsConfig
setValidatePrimaryKey(Boolean validatePrimaryKey)
ConstraintsConfig
setValidatePrimaryKey(String validatePrimaryKey)
Set the validatePrimaryKey field based on the passed string.ConstraintsConfig
setValidateUnique(Boolean validateUnique)
ConstraintsConfig
setValidateUnique(String validateUnique)
Set the validateUnique field based on the passed string.-
Methods inherited from class liquibase.serializer.AbstractLiquibaseSerializable
convertEscaped, getSerializableFieldDataTypeClass, getSerializableFieldDataTypeClassParameters, getSerializableFieldNamespace, getSerializableFields, getSerializableFieldType, getSerializableFieldValue, serialize, serializeValue, setSerializableFieldValue, shouldAutoLoad
-
-
-
-
Method Detail
-
isNullable
public Boolean isNullable()
Returns if the column should be nullable. Returns null if unspecified.
-
setNullable
public ConstraintsConfig setNullable(Boolean nullable)
-
setNullable
public ConstraintsConfig setNullable(String nullable)
Set the nullable parameter based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if a different value is passed
-
getNotNullConstraintName
public String getNotNullConstraintName()
IfisNullable()
is 'false' and database supports named not null constraints- Returns:
- not null constraint name
- See Also:
getUniqueConstraintName()
-
setNotNullConstraintName
public ConstraintsConfig setNotNullConstraintName(String notNullConstraintName)
-
isPrimaryKey
public Boolean isPrimaryKey()
Returns true if the column should be part of the primary key. Returns null if unspecified
-
setPrimaryKey
public ConstraintsConfig setPrimaryKey(Boolean primaryKey)
-
setPrimaryKey
public ConstraintsConfig setPrimaryKey(String primaryKey)
Set the primaryKey parameter based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if a different value is passed
-
getPrimaryKeyName
public String getPrimaryKeyName()
Returns the name to use for the primary key constraint. Returns null if not specified
-
setPrimaryKeyName
public ConstraintsConfig setPrimaryKeyName(String primaryKeyName)
-
getReferences
public String getReferences()
Returns the "references" clause to use for the foreign key. Normally a string of the format TABLE(COLUMN_NAME). Returns null if not specified
-
setReferences
public ConstraintsConfig setReferences(String references)
-
isUnique
public Boolean isUnique()
Returns if the column is part of a unique constraint. Returns null if not specified
-
setUnique
public ConstraintsConfig setUnique(Boolean unique)
-
setUnique
public ConstraintsConfig setUnique(String unique)
Set the unique parameter based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if a different value is passed
-
getUniqueConstraintName
public String getUniqueConstraintName()
Returns the name to use for the unique constraint. Returns null if not specified
-
setUniqueConstraintName
public ConstraintsConfig setUniqueConstraintName(String uniqueConstraintName)
-
getCheckConstraint
public String getCheckConstraint()
Returns the check constraint to use on this column. Returns null if not specified
-
setCheckConstraint
public ConstraintsConfig setCheckConstraint(String checkConstraint)
-
isDeleteCascade
public Boolean isDeleteCascade()
Returns if a foreign key defined for this column should cascade deletes. Returns null if not specified.
-
setDeleteCascade
public ConstraintsConfig setDeleteCascade(Boolean deleteCascade)
-
setDeleteCascade
public ConstraintsConfig setDeleteCascade(String deleteCascade)
Set the deleteCascade parameter based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if a different value is passed
-
getForeignKeyName
public String getForeignKeyName()
Returns the name to use for the columns foreign key constraint. Returns null if not specified.
-
setForeignKeyName
public ConstraintsConfig setForeignKeyName(String foreignKeyName)
-
isInitiallyDeferred
public Boolean isInitiallyDeferred()
Returns if a foreign key defined for this column should be "initially deferred". Returns null if not specified.
-
setInitiallyDeferred
public ConstraintsConfig setInitiallyDeferred(Boolean initiallyDeferred)
-
setInitiallyDeferred
public ConstraintsConfig setInitiallyDeferred(String initiallyDeferred)
Set the initiallyDeferred parameter based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if a different value is passed
-
isDeferrable
public Boolean isDeferrable()
Returns if a foreign key defined for this column should deferrable. Returns null if not specified.
-
setDeferrable
public ConstraintsConfig setDeferrable(Boolean deferrable)
-
setValidateNullable
public ConstraintsConfig setValidateNullable(String validateNullable)
Set the validateNullable field based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if an invalid value is passed
-
getValidateNullable
public Boolean getValidateNullable()
Returns whether a NotNullConst defined for this column should validate. Returns null if not setValidateNullable has not been called.
-
setValidateNullable
public ConstraintsConfig setValidateNullable(Boolean validateNullable)
-
setValidateUnique
public ConstraintsConfig setValidateUnique(String validateUnique)
Set the validateUnique field based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if an invalid value is passed
-
getValidateUnique
public Boolean getValidateUnique()
Returns whether a UniqueConst defined for this column should validate. Returns null if not setValidateUnique has not been called.
-
setValidateUnique
public ConstraintsConfig setValidateUnique(Boolean validateUnique)
-
setValidatePrimaryKey
public ConstraintsConfig setValidatePrimaryKey(String validatePrimaryKey)
Set the validatePrimaryKey field based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if an invalid value is passed
-
getValidatePrimaryKey
public Boolean getValidatePrimaryKey()
Returns whether a PrimaryKeyConst defined for this column should validate. Returns null if not setValidatePrimaryKey has not been called.
-
setValidatePrimaryKey
public ConstraintsConfig setValidatePrimaryKey(Boolean validatePrimaryKey)
-
setValidateForeignKey
public ConstraintsConfig setValidateForeignKey(String validateForeignKey)
Set the validateForeignKey field based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if an invalid value is passed
-
getValidateForeignKey
public Boolean getValidateForeignKey()
Returns whether a ForeignKeyConst defined for this column should validate. Returns null if not setValidateForeignKey has not been called.
-
setValidateForeignKey
public ConstraintsConfig setValidateForeignKey(Boolean validateForeignKey)
-
setDeferrable
public ConstraintsConfig setDeferrable(String deferrable)
Set the deferrable parameter based on the passed string. Sets true if the passed string is 1 or true or TRUE. Sets false if the passed string is 0 or false or FALSE. Sets null if the passed string is null or "null" or "NULL". Throws anUnexpectedLiquibaseException
if a different value is passed
-
getPrimaryKeyTablespace
public String getPrimaryKeyTablespace()
Returns the tablespace to use for the defined primary key. Returns null if not specified.
-
setPrimaryKeyTablespace
public ConstraintsConfig setPrimaryKeyTablespace(String primaryKeyTablespace)
-
getReferencedTableCatalogName
public String getReferencedTableCatalogName()
-
setReferencedTableCatalogName
public void setReferencedTableCatalogName(String referencedTableCatalogName)
-
getReferencedTableSchemaName
public String getReferencedTableSchemaName()
-
setReferencedTableSchemaName
public void setReferencedTableSchemaName(String referencedTableSchemaName)
-
getReferencedTableName
public String getReferencedTableName()
-
setReferencedTableName
public void setReferencedTableName(String referencedTableName)
-
getReferencedColumnNames
public String getReferencedColumnNames()
-
setReferencedColumnNames
public void setReferencedColumnNames(String referencedColumnNames)
-
getSerializedObjectName
public String getSerializedObjectName()
-
getSerializedObjectNamespace
public String getSerializedObjectNamespace()
-
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException
- Specified by:
load
in interfaceLiquibaseSerializable
- Overrides:
load
in classAbstractLiquibaseSerializable
- Throws:
ParsedNodeException
-
-