classDropConstraint
final class DropConstraint
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.DROP CONSTRAINT: removes a constraint.
Mirrors AT_DropConstraint with missing_ok and behavior. Source: https://www.postgresql.org/docs/17/sql-altertable.html.
$statement = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER TABLE t DROP CONSTRAINT IF EXISTS c RESTRICT');
$statement->toString() // => 'ALTER TABLE t DROP CONSTRAINT IF EXISTS c RESTRICT'Properties§
public Name $namepublic bool $ifExists = falsepublic DropBehavior|null $behavior = nullMethods§
public function __construct(
public Name $name,
public bool $ifExists = false,
public DropBehavior|null $behavior = null,
)Parameters
$name | Name | The constraint |
$ifExists | bool | Whether IF EXISTS is written |
$behavior | DropBehavior|null | CASCADE or RESTRICT, when written |
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives nothing: the constraint is a catalog name.
Parameters
$derivation | Derivation | |
$environment | Environment |
public function render(Output $out): voidWrites the action.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 53
- method-call Output::name() line 57
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
DropConstraintTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterCommandRule::relation() packages/sql-semantics-postgres/src/Lowering/Table/AlterCommandRule.php:188
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterCommandRule::relation() packages/sql-semantics-postgres/src/Lowering/Table/AlterCommandRule.php:189