classConstraintEnforcement
final class ConstraintEnforcement
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.ALTER CHECK c [NOT] ENFORCED or ALTER CONSTRAINT c [NOT] ENFORCED (8.0.16 and later).
Mirrors PT_alter_table_enforce_check_constraint and PT_alter_table_enforce_constraint: CHECK names a check constraint, CONSTRAINT a constraint of any kind (the server accepts the request only for a check constraint). Source: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html#alter-table-foreign-check-constraints.
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t ALTER CHECK c NOT ENFORCED');
[$alter->statement->commands[0]->enforced, $alter->toString()] // => [false, 'ALTER TABLE t ALTER CHECK c NOT ENFORCED']Properties§
public ElementKind $kindpublic Name $constraintpublic bool $enforcedMethods§
public function __construct(
public ElementKind $kind,
public Name $constraint,
public bool $enforced,
)Parameters
$kind | ElementKind | CHECK or CONSTRAINT |
$constraint | Name | The constraint name |
$enforced | bool | Whether ENFORCED (true) or NOT ENFORCED (false) is written |
Calls 3
- static-call Check::input() line 41
- class-const ElementKind::Check() line 41
- class-const ElementKind::Constraint() line 41
public function deriveCommand(Derivation $derivation, Environment $scope): voidDerives nothing: the action holds no expression.
Parameters
$derivation | Derivation | |
$scope | Environment |
public function render(Output $out): voidWrites the action.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 56
- class-const NameUse::Label() line 56
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.