classAddConstraint
final class AddConstraint
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.ADD table_constraint: adds a constraint.
Mirrors AT_AddConstraint. The constraint is derived where the relation is visible. Source: https://www.postgresql.org/docs/17/sql-altertable.html.
$statement = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER TABLE t ADD CONSTRAINT c CHECK (a > 0) NOT VALID');
$statement->toString() // => 'ALTER TABLE t ADD CONSTRAINT c CHECK (a > 0) NOT VALID'Properties§
public Constraint $constraintMethods§
public function __construct(public Constraint $constraint)Parameters
$constraint | Constraint | The constraint |
Calls 3
- static-call Check::input() line 35
- method-call TableConstraints::admits() line 35
- new TableConstraints line 35
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the constraint against the relation.
Parameters
$derivation | Derivation | |
$environment | Environment |
Calls 1
- method-call Constraint::deriveClause() line 43
public function render(Output $out): voidTest cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Other tests reaching this symbol 1
Relations§
Instantiated in 1
Type checks 3
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\AlterKinds::foreign() packages/sql-semantics-postgres/src/Rules/Table/Command/AlterKinds.php:114
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\AlterKinds::relationWide() packages/sql-semantics-postgres/src/Rules/Table/Command/AlterKinds.php:178
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::identity() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:101