Package liquibase.structure.core
Class UniqueConstraint
- java.lang.Object
-
- liquibase.structure.AbstractDatabaseObject
-
- liquibase.structure.core.UniqueConstraint
-
- All Implemented Interfaces:
Comparable,LiquibaseSerializable,DatabaseObject
public class UniqueConstraint extends AbstractDatabaseObject
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
-
-
Field Summary
-
Fields inherited from class liquibase.structure.AbstractDatabaseObject
CURLY_BRACKET_PATTERN
-
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 UniqueConstraint()UniqueConstraint(String name, String tableCatalog, String tableSchema, String tableName, Column... columns)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description UniqueConstraintaddColumn(int position, Column column)intcompareTo(Object other)booleanequals(Object o)IndexgetBackingIndex()StringgetColumnNames()List<Column>getColumns()DatabaseObject[]getContainingObjects()StringgetName()RelationgetRelation()SchemagetSchema()TablegetTable()Deprecated.UsegetRelation()inthashCode()booleanisClustered()booleanisDeferrable()booleanisDisabled()booleanisInitiallyDeferred()voidload(ParsedNode parsedNode, ResourceAccessor resourceAccessor)UniqueConstraintsetBackingIndex(Index backingIndex)UniqueConstraintsetClustered(boolean clustered)UniqueConstraintsetColumns(List<Column> columns)UniqueConstraintsetDeferrable(boolean deferrable)UniqueConstraintsetDisabled(boolean disabled)UniqueConstraintsetInitiallyDeferred(boolean initiallyDeferred)UniqueConstraintsetName(String constraintName)Sets the name for the database object.UniqueConstraintsetRelation(Relation relation)UniqueConstraintsetShouldValidate(boolean shouldValidate)UniqueConstraintsetTable(Table table)Deprecated.booleanshouldValidate()In Oracle PL/SQL, the VALIDATE keyword defines whether a newly added unique constraint on a column in a table should cause existing rows to be checked to see if they satisfy the uniqueness constraint or not.StringtoString()-
Methods inherited from class liquibase.structure.AbstractDatabaseObject
getAttribute, getAttribute, getAttributes, getObjectTypeName, getSerializableFieldNamespace, getSerializableFields, getSerializableFieldType, getSerializableFieldValue, getSerializedObjectName, getSerializedObjectNamespace, getSnapshotId, serialize, setAttribute, setSnapshotId, shouldIncludeCatalogInSpecification, snapshotByDefault
-
-
-
-
Method Detail
-
getContainingObjects
public DatabaseObject[] getContainingObjects()
-
getName
public String getName()
-
setName
public UniqueConstraint setName(String constraintName)
Description copied from interface:DatabaseObjectSets the name for the database object.- Parameters:
constraintName- the new name for the database object- Returns:
- a reference to the same object (implementing classes are expected to return a reference to the same object).
-
getSchema
public Schema getSchema()
-
getTable
@Deprecated public Table getTable()
Deprecated.UsegetRelation()
-
setTable
@Deprecated public UniqueConstraint setTable(Table table)
Deprecated.
-
getRelation
public Relation getRelation()
-
setRelation
public UniqueConstraint setRelation(Relation relation)
-
setColumns
public UniqueConstraint setColumns(List<Column> columns)
-
addColumn
public UniqueConstraint addColumn(int position, Column column)
-
isDeferrable
public boolean isDeferrable()
-
setDeferrable
public UniqueConstraint setDeferrable(boolean deferrable)
-
shouldValidate
public boolean shouldValidate()
In Oracle PL/SQL, the VALIDATE keyword defines whether a newly added unique constraint on a column in a table should cause existing rows to be checked to see if they satisfy the uniqueness constraint or not.- Returns:
- true if ENABLE VALIDATE (this is the default), or false if ENABLE NOVALIDATE.
-
setShouldValidate
public UniqueConstraint setShouldValidate(boolean shouldValidate)
- Parameters:
shouldValidate- - if shouldValidate is set to FALSE then the constraint will be created with the 'ENABLE NOVALIDATE' mode. This means the constraint would be created, but that no check will be done to ensure old data has valid constraints - only new data would be checked to see if it complies with the constraint logic. The default state for unique constraints is to have 'ENABLE VALIDATE' set.
-
isInitiallyDeferred
public boolean isInitiallyDeferred()
-
setInitiallyDeferred
public UniqueConstraint setInitiallyDeferred(boolean initiallyDeferred)
-
getColumnNames
public String getColumnNames()
-
setDisabled
public UniqueConstraint setDisabled(boolean disabled)
-
isDisabled
public boolean isDisabled()
-
getBackingIndex
public Index getBackingIndex()
-
setBackingIndex
public UniqueConstraint setBackingIndex(Index backingIndex)
-
setClustered
public UniqueConstraint setClustered(boolean clustered)
-
isClustered
public boolean isClustered()
-
compareTo
public int compareTo(Object other)
- Specified by:
compareToin interfaceComparable- Overrides:
compareToin classAbstractDatabaseObject
-
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException
- Specified by:
loadin interfaceLiquibaseSerializable- Overrides:
loadin classAbstractDatabaseObject- Throws:
ParsedNodeException
-
toString
public String toString()
- Overrides:
toStringin classAbstractDatabaseObject
-
-