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

A UNIQUE column constraint.

Rule: SQLITE-COLUMN-UNIQUE-001. No two rows may have the same non-NULL value in the column; the conflict resolution says what a violating write does and defaults to ABORT. Source: https://sqlite.org/lang_createtable.html#unique_constraints. Status: Implemented.

Reading a UNIQUE column constraintdoctest
$create = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('CREATE TABLE t (a UNIQUE ON CONFLICT REPLACE)');
    $create->statement->columns[0]->constraints[0]->conflict?->value // => 'REPLACE'

Properties§

public ConflictResolution|null $conflict = null

Methods§

public function __construct(public ConflictResolution|null $conflict = null)

Parameters

$conflictConflictResolution|nullThe written ON CONFLICT resolution
public function deriveConstraint(Derivation $derivation, ConstraintScope $scope): void

Derives nothing: the clause has no operand that depends on a declaration.

Parameters

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

Writes the clause.

Parameters

$outOutput
Calls 1

Test cases 3§

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 2

Relations§

Instantiated in 1
Type checks 1