classAddConstraint
final class AddConstraint
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.ADD key or constraint: a request to add an index, a key, a foreign key or a check constraint.
Mirrors PT_alter_table_add_constraint. The expressions of the element (functional key parts, the check condition) are derived in the scope of the changed table. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html.
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t ADD INDEX i (a)');
$alter->toString() // => 'ALTER TABLE t ADD INDEX i (a)'Properties§
public TableElement $elementMethods§
public function __construct(public TableElement $element)Parameters
$element | TableElement | The key or constraint |
public function deriveCommand(Derivation $derivation, Environment $scope): voidDerives the expressions of the element.
Parameters
$derivation | Derivation | |
$scope | Environment |
Calls 2
- method-call ElementFacts::element() line 44
- new ElementFacts line 44
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
AddConstraintTestcalls