final class ConstraintName
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The CONSTRAINT clause before a key or check: the keyword with an optional constraint symbol.

Without a symbol the server generates the constraint name. MySQL 5.x lets a table qualify the symbol; the qualifier is kept as written. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table.html.

Reading the symbol of a constraintdoctest
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE TABLE t (a INT, CONSTRAINT c UNIQUE (a))');
    $create->statement->elements[1]->constraint->name->column->value // => 'c'

Properties§

public ColumnName|null $name = null

Methods§

public function __construct(public ColumnName|null $name = null)

Parameters

$nameColumnName|nullThe constraint symbol, when written
public function render(Output $out): void

Writes CONSTRAINT and the symbol.

Parameters

$outOutput
Calls 1

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
Type declarations 5