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.

Adding two columnsdoctest
$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> $elements

Methods§

public function __construct(list<TableElement> $elements)

Parameters

$elementslist<TableElement>The elements in order; at least one
Calls 3
public function deriveCommand(Derivation $derivation, Environment $scope): void

Derives the expressions of the elements.

Parameters

$derivationDerivation
$scopeEnvironment
Calls 2
public function render(Output $out): void

Writes the action.

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 checks 1