final class Deferrability
    implements ColumnConstraint
    uses Snapshot
Public API: explicitly declared with @visibility public.

A DEFERRABLE or NOT DEFERRABLE clause of a foreign key.

Rule: SQLITE-FK-DEFERRABLE-001. A foreign key is checked at the end of the transaction only when the clause is DEFERRABLE INITIALLY DEFERRED; every other form, NOT DEFERRABLE INITIALLY DEFERRED included, is checked at the end of each statement. Written as a column constraint, the clause applies to the foreign key defined last before it in the table definition and has no effect when there is none. Source: https://sqlite.org/foreignkeys.html#fk_deferred. Status: Implemented.

Telling a deferred foreign key from an immediate onedoctest
$semantics = new \SqlSemantics\Platform\Sqlite\Semantics();
    $deferred = $semantics->analyze('CREATE TABLE c (p REFERENCES parent DEFERRABLE INITIALLY DEFERRED)')->statement->columns[0]->constraints[1];
    $immediate = $semantics->analyze('CREATE TABLE c (p REFERENCES parent NOT DEFERRABLE INITIALLY DEFERRED)')->statement->columns[0]->constraints[1];
    [$deferred->deferred(), $immediate->deferred()] // => [true, false]

Properties§

public bool $deferrable
public InitialMode|null $initially = null

Methods§

public function __construct(public bool $deferrable, public InitialMode|null $initially = null)

Parameters

$deferrableboolWhether DEFERRABLE is written without NOT
$initiallyInitialMode|nullThe word written after INITIALLY
public function deferred(): bool

Tells whether the foreign key is checked at the end of the transaction.

Returns

bool
Test cases 1
Calls 1
public function deriveConstraint(Derivation $derivation, ConstraintScope $scope): void

Derives nothing: the clause has no operand.

Parameters

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

Writes the clause.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 6§

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

Dedicated tests 3
Other tests reaching this symbol 3

Relations§

Instantiated in 2
Type declarations 3