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.

Suspending a check constraintdoctest
$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 $kind
public Name $constraint
public bool $enforced

Methods§

public function __construct(
    public ElementKind $kind,
    public Name $constraint,
    public bool $enforced,
)

Parameters

$kindElementKindCHECK or CONSTRAINT
$constraintNameThe constraint name
$enforcedboolWhether ENFORCED (true) or NOT ENFORCED (false) is written
Calls 3
public function deriveCommand(Derivation $derivation, Environment $scope): void

Derives nothing: the action holds no expression.

Parameters

$derivationDerivation
$scopeEnvironment
public function render(Output $out): void

Writes the action.

Parameters

$outOutput
Calls 2

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1