Package liquibase.structure.core
Class ForeignKey
- java.lang.Object
-
- liquibase.structure.AbstractDatabaseObject
-
- liquibase.structure.core.ForeignKey
-
- All Implemented Interfaces:
Comparable
,LiquibaseSerializable
,DatabaseObject
public class ForeignKey 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 ForeignKey()
ForeignKey(String name)
ForeignKey(String name, String foreignKeyCatalog, String foreignKeySchema, String foreignKeyTable, Column... baseTableColumns)
-
Method Summary
-
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()
-
getSchema
public Schema getSchema()
-
getPrimaryKeyTable
public Table getPrimaryKeyTable()
-
setPrimaryKeyTable
public ForeignKey setPrimaryKeyTable(Table primaryKeyTable)
-
setPrimaryKeyColumns
public ForeignKey setPrimaryKeyColumns(List<Column> primaryKeyColumns)
-
addPrimaryKeyColumn
public ForeignKey addPrimaryKeyColumn(Column primaryKeyColumn)
-
getForeignKeyTable
public Table getForeignKeyTable()
-
setForeignKeyTable
public ForeignKey setForeignKeyTable(Table foreignKeyTable)
-
setForeignKeyColumns
public ForeignKey setForeignKeyColumns(List<Column> foreignKeyColumns)
-
addForeignKeyColumn
public ForeignKey addForeignKeyColumn(Column foreignKeyColumn)
-
getName
public String getName()
-
setName
public ForeignKey setName(String name)
Description copied from interface:DatabaseObject
Sets 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).
-
toString
public String toString()
- Overrides:
toString
in classAbstractDatabaseObject
-
isDeferrable
public boolean isDeferrable()
-
setDeferrable
public ForeignKey setDeferrable(boolean deferrable)
-
isInitiallyDeferred
public boolean isInitiallyDeferred()
-
setInitiallyDeferred
public ForeignKey setInitiallyDeferred(boolean initiallyDeferred)
-
shouldValidate
public boolean shouldValidate()
In Oracle PL/SQL, the VALIDATE keyword defines whether a foreign key constraint on a column in a table should be checked if it refers to a valid row or not.- Returns:
- true if ENABLE VALIDATE (this is the default), or false if ENABLE NOVALIDATE.
-
setShouldValidate
public ForeignKey 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 foreign keys - only new data would be checked to see if it complies with the constraint logic. The default state for foreign keys is to have 'ENABLE VALIDATE' set.
-
getUpdateRule
public ForeignKeyConstraintType getUpdateRule()
-
setUpdateRule
public ForeignKey setUpdateRule(ForeignKeyConstraintType rule)
-
getDeleteRule
public ForeignKeyConstraintType getDeleteRule()
-
setDeleteRule
public ForeignKey setDeleteRule(ForeignKeyConstraintType rule)
-
compareTo
public int compareTo(Object other)
- Specified by:
compareTo
in interfaceComparable
- Overrides:
compareTo
in classAbstractDatabaseObject
-
getBackingIndex
public Index getBackingIndex()
-
setBackingIndex
public ForeignKey setBackingIndex(Index backingIndex)
-
-