classConstraintName
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.
$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 = nullMethods§
public function __construct(public ColumnName|null $name = null)Parameters
$name | ColumnName|null | The constraint symbol, when written |
public function render(Output $out): voidTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ConstraintNameTestcalls
Relations§
Instantiated in 1
Type declarations 5
- type SqlSemantics\Platform\MySql\Lowering\TableDefinition\Key\KeyRule packages/sql-semantics-mysql/src/Lowering/TableDefinition/Key/KeyRule.php:132
- type SqlSemantics\Platform\MySql\Lowering\TableDefinition\Key\KeyRule packages/sql-semantics-mysql/src/Lowering/TableDefinition/Key/KeyRule.php:149
- type SqlSemantics\Platform\MySql\Statement\Table\Key\CheckConstraint packages/sql-semantics-mysql/src/Statement/Table/Key/CheckConstraint.php:40
- type SqlSemantics\Platform\MySql\Statement\Table\Key\ForeignKey packages/sql-semantics-mysql/src/Statement/Table/Key/ForeignKey.php:44
- type SqlSemantics\Platform\MySql\Statement\Table\Key\IndexDefinition packages/sql-semantics-mysql/src/Statement/Table/Key/IndexDefinition.php:64