Package dev.frostlake.metastore.model
Class UniqueConstraint
java.lang.Object
dev.frostlake.metastore.model.UniqueConstraint
One UNIQUE constraint, spanning one or more columns.
Frostlake enforces uniqueness through a per-column flag on TableColumn; this record sits
ALONGSIDE those flags and remembers the two things a boolean flag cannot express — the name an explicit
CONSTRAINT <name> UNIQUE (...) clause gave the constraint, and the fact that several columns
belong to ONE constraint rather than to one constraint each. A bare column-level UNIQUE needs
neither, so it has no record; Table.uniqueConstraintName(String) names it instead and
Table.getUniqueConstraints() synthesizes its single-column entry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTrue when this constraint spans the named column (case-insensitively).voidrenameColumn(String oldName, String newName) Follow a column rename: the constraint is unchanged, only the name of a column it spans moved.voidsetConstraintName(String constraintName) Rename it in place — ALTER TABLE … RENAME CONSTRAINT.toString()
-
Constructor Details
-
UniqueConstraint
- Parameters:
constraintName- the name from an explicitCONSTRAINT <name>clause; null or blank when the constraint was declared without one, in which case it is auto-namedSYS_CONSTRAINT_<uuid>the way Snowflake does (seeConstraintNames).
-
-
Method Details
-
getConstraintName
-
setConstraintName
Rename it in place — ALTER TABLE … RENAME CONSTRAINT. -
getColumnNames
-
covers
True when this constraint spans the named column (case-insensitively). -
renameColumn
Follow a column rename: the constraint is unchanged, only the name of a column it spans moved. -
toString
-