Interface IConstraint
- All Superinterfaces:
ISearchPath,IStatement,ISubElement
- All Known Subinterfaces:
IConstraintFk,IConstraintPk
- All Known Implementing Classes:
ChConstraint,MetaConstraint,MsConstraint,MsConstraintCheck,MsConstraintFk,MsConstraintPk,PgConstraint,PgConstraintCheck,PgConstraintExclude,PgConstraintFk,PgConstraintNotNull,PgConstraintPk
Interface for database table constraints.
Provides common functionality for all constraint types including primary keys,
foreign keys, unique constraints, and check constraints.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsColumn(String name) Checks if this constraint involves the specified column.Gets the columns involved in this constraint.Gets the SQL definition of this constraint.default DbObjTypeGets the type of this database object.Gets the name of the table this constraint belongs to.default booleanChecks if this constraint is a primary key constraint.Methods inherited from interface org.pgcodekeeper.core.database.api.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendAlterSQL, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, compare, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getCreationSQL, getDependencies, getDescendants, getDropSQL, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQualifiedName, getQuotedName, getQuoter, getRenameCommand, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopyMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISubElement
getContainingSchema, toObjectReference
-
Method Details
-
isPrimaryKey
default boolean isPrimaryKey()Checks if this constraint is a primary key constraint.- Returns:
- true if this is a primary key constraint
-
getDefinition
String getDefinition()Gets the SQL definition of this constraint.- Returns:
- the constraint definition
-
getColumns
Collection<String> getColumns()Gets the columns involved in this constraint.- Returns:
- a collection of column names
-
containsColumn
Checks if this constraint involves the specified column.- Parameters:
name- the column name to check- Returns:
- true if the column is part of this constraint
-
getTableName
String getTableName()Gets the name of the table this constraint belongs to.- Returns:
- the table name
-
getStatementType
Description copied from interface:IStatementGets the type of this database object.- Specified by:
getStatementTypein interfaceIStatement- Returns:
- the database object type
-