classAddColumns
final class AddColumns
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.ADD [COLUMN] (element, …): a request to add several columns, and in 8.0 also keys and constraints, at the end of the table.
Mirrors PT_alter_table_add_columns. The expressions of the elements are derived in the scope of the changed table. The word COLUMN is optional and always written. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html#alter-table-add-drop-column.
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t ADD (b INT, c INT)');
[count($alter->statement->commands[0]->elements), $alter->toString()] // => [2, 'ALTER TABLE t ADD COLUMN (b INT, c INT)']Properties§
public list<TableElement> $elementsMethods§
public function __construct(list<TableElement> $elements)Parameters
$elements | list<TableElement> | The elements in order; at least one |
Calls 3
- static-call Check::input() line 43
- static-call Check::listOf() line 44
- class-const TableElement::class() line 44
public function deriveCommand(Derivation $derivation, Environment $scope): voidDerives the expressions of the elements.
Parameters
$derivation | Derivation | |
$scope | Environment |
Calls 2
- method-call ElementFacts::element() line 53
- new ElementFacts line 53
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
AddColumnsTestcalls