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 UniqueConstraint
addColumn(int position, Column column)
int
compareTo(Object other)
boolean
equals(Object o)
Index
getBackingIndex()
String
getColumnNames()
List<Column>
getColumns()
DatabaseObject[]
getContainingObjects()
String
getName()
Relation
getRelation()
Schema
getSchema()
Table
getTable()
Deprecated.UsegetRelation()
int
hashCode()
boolean
isClustered()
boolean
isDeferrable()
boolean
isDisabled()
boolean
isInitiallyDeferred()
void
load(ParsedNode parsedNode, ResourceAccessor resourceAccessor)
UniqueConstraint
setBackingIndex(Index backingIndex)
UniqueConstraint
setClustered(boolean clustered)
UniqueConstraint
setColumns(List<Column> columns)
UniqueConstraint
setDeferrable(boolean deferrable)
UniqueConstraint
setDisabled(boolean disabled)
UniqueConstraint
setInitiallyDeferred(boolean initiallyDeferred)
UniqueConstraint
setName(String constraintName)
Sets the name for the database object.UniqueConstraint
setRelation(Relation relation)
UniqueConstraint
setShouldValidate(boolean shouldValidate)
UniqueConstraint
setTable(Table table)
Deprecated.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.String
toString()
-
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:DatabaseObject
Sets 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:
compareTo
in interfaceComparable
- Overrides:
compareTo
in classAbstractDatabaseObject
-
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException
- Specified by:
load
in interfaceLiquibaseSerializable
- Overrides:
load
in classAbstractDatabaseObject
- Throws:
ParsedNodeException
-
toString
public String toString()
- Overrides:
toString
in classAbstractDatabaseObject
-
-