Class DropTableConstraint


public class DropTableConstraint extends PostgresSqlPart

Generates a ALTER TABLE...DROP CONSTRAINT statement for PostgreSQL.


Sample Generated SQL:

ALTER TABLE IF EXISTS "person" DROP CONSTRAINT IF EXISTS "email_check"
  • Constructor Details

    • DropTableConstraint

      public DropTableConstraint()
    • DropTableConstraint

      public DropTableConstraint(String tableName, String constraintName)
  • Method Details

    • setPretty

      public DropTableConstraint setPretty(boolean pretty)
      Description copied from class: SqlPart
      Indicates if SqlPart.getSqlFragment() adds line breaks and indentation instead of using one line (default is false).
      Overrides:
      setPretty in class SqlPart
    • collectSqlFragment

      public void collectSqlFragment(CodeWriter writer)
      Description copied from class: SqlPart
      Writes this part's SQL to the writer; used by SqlPart.getSqlFragment() and by enclosing parts.
      Specified by:
      collectSqlFragment in class SqlPart
    • getTableName

      public String getTableName()
    • setTableName

      public DropTableConstraint setTableName(String tableName)
    • getConstraintName

      public String getConstraintName()
    • setConstraintName

      public DropTableConstraint setConstraintName(String constraintName)
    • isCheckIfTableExists

      public boolean isCheckIfTableExists()
      Indicates if the IF EXISTS clause should be added to the ALTER TABLE statement before the table name (default true).
    • setCheckIfTableExists

      public DropTableConstraint setCheckIfTableExists(boolean checkIfTableExists)
      Indicates if the IF EXISTS clause should be added to the ALTER TABLE statement before the table name (default true).
    • isCheckIfConstraintExists

      public boolean isCheckIfConstraintExists()
      Indicates if IF EXISTS clause should be added to the ALTER TABLE...DROP CONSTRAINT statement before the constraint name (default true).
    • setCheckIfConstraintExists

      public DropTableConstraint setCheckIfConstraintExists(boolean checkIfConstraintExists)
      Indicates if IF EXISTS clause should be added to the ALTER TABLE...DROP CONSTRAINT statement before the constraint name (default true).
    • isCascade

      public boolean isCascade()
    • setCascade

      public DropTableConstraint setCascade(boolean cascade)
    • isRestrict

      public boolean isRestrict()
      Returns the inverse of isCascade(); no RESTRICT keyword is ever written.