classAddColumn
final class AddColumn
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.ADD [COLUMN] definition [FIRST | AFTER column]: a request to add one column.
Mirrors PT_alter_table_add_column. The expressions of the definition 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 AFTER a');
[$alter->statement->commands[0]->column->name->column->value, $alter->toString()] // => ['b', 'ALTER TABLE t ADD COLUMN b INT AFTER a']Properties§
public ColumnDefinition $columnpublic ColumnPosition|null $position = nullMethods§
public function __construct(
public ColumnDefinition $column,
public ColumnPosition|null $position = null,
)Parameters
$column | ColumnDefinition | The new column |
$position | ColumnPosition|null | Where the column goes, when written |
public function deriveCommand(Derivation $derivation, Environment $scope): voidDerives the expressions of the definition.
Parameters
$derivation | Derivation | |
$scope | Environment |
Calls 2
- method-call ElementFacts::element() line 45
- new ElementFacts line 45
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
AddColumnTestcalls