Package liquibase.structure.core
Class PrimaryKey
- java.lang.Object
-
- liquibase.structure.AbstractDatabaseObject
-
- liquibase.structure.core.PrimaryKey
-
- All Implemented Interfaces:
Comparable,LiquibaseSerializable,DatabaseObject
public class PrimaryKey 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 PrimaryKey()PrimaryKey(String name, String tableCatalogName, String tableSchemaName, String tableName, Column... columns)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PrimaryKeyaddColumn(int position, Column column)Adds a new column to the column list of this PrimaryKey.intcompareTo(Object other)booleanequals(Object o)IndexgetBackingIndex()StringgetColumnNames()List<String>getColumnNamesAsList()List<Column>getColumns()DatabaseObject[]getContainingObjects()StringgetName()SchemagetSchema()TablegetTable()Returns the Table object this PrimaryKey belongs to.StringgetTablespace()inthashCode()booleanisCertainName()PrimaryKeysetBackingIndex(Index backingIndex)PrimaryKeysetCertainName(boolean certainName)PrimaryKeysetName(String name)Sets the name for the database object.PrimaryKeysetShouldValidate(boolean shouldValidate)PrimaryKeysetTable(Table table)Sets the Table object this PrimaryKey belongs to.PrimaryKeysetTablespace(String tablespace)StringtoString()-
Methods inherited from class liquibase.structure.AbstractDatabaseObject
getAttribute, getAttribute, getAttributes, getObjectTypeName, getSerializableFieldNamespace, getSerializableFields, getSerializableFieldType, getSerializableFieldValue, getSerializedObjectName, getSerializedObjectNamespace, getSnapshotId, load, serialize, setAttribute, setSnapshotId, shouldIncludeCatalogInSpecification, snapshotByDefault
-
-
-
-
Method Detail
-
getContainingObjects
public DatabaseObject[] getContainingObjects()
-
getName
public String getName()
-
setName
public PrimaryKey setName(String name)
Description copied from interface:DatabaseObjectSets the name for the database object.- Parameters:
name- 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()
-
getColumnNames
public String getColumnNames()
-
addColumn
public PrimaryKey addColumn(int position, Column column)
Adds a new column to the column list of this PrimaryKey. The first column has the position 0. If you specify a position that is greater than the number of columns present, undefined columns (NULL expressions) will be added as padding. If a position that is already occupied by a column is specified, that column will be replaced.- Parameters:
position- the position where to insert or replace the columncolumn- the new column- Returns:
- a reference to the updated PrimaryKey object.
-
getTable
public Table getTable()
Returns the Table object this PrimaryKey belongs to.- Returns:
- the Table object, or null if not initialized yet.
-
setTable
public PrimaryKey setTable(Table table)
Sets the Table object this PrimaryKey belongs to.- Parameters:
table- the table object to set as the container for this PrimaryKey- Returns:
- the updated object
-
compareTo
public int compareTo(Object other)
- Specified by:
compareToin interfaceComparable- Overrides:
compareToin classAbstractDatabaseObject
-
toString
public String toString()
- Overrides:
toStringin classAbstractDatabaseObject
-
isCertainName
public boolean isCertainName()
-
setCertainName
public PrimaryKey setCertainName(boolean certainName)
-
getTablespace
public String getTablespace()
-
setTablespace
public PrimaryKey setTablespace(String tablespace)
-
getBackingIndex
public Index getBackingIndex()
-
setBackingIndex
public PrimaryKey setBackingIndex(Index backingIndex)
-
setShouldValidate
public PrimaryKey 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 primary keys - only new data would be checked to see if it complies with the constraint logic. The default state for primary keys is to have 'ENABLE VALIDATE' set.
-
-