classRenameElement
final class RenameElement
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.RENAME INDEX old TO new (5.7 and later) or RENAME COLUMN old TO new (8.0 and later).
Mirrors PT_alter_table_rename_key and PT_alter_table_rename_column. KEY and INDEX are synonyms. 5.7 lets a table qualify an index name. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html.
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t RENAME COLUMN a TO b');
[$alter->statement->commands[0]->to->column->value, $alter->toString()] // => ['b', 'ALTER TABLE t RENAME COLUMN a TO b']Properties§
public ElementKind $kindpublic ColumnName $frompublic ColumnName $toMethods§
public function __construct(
public ElementKind $kind,
public ColumnName $from,
public ColumnName $to,
)Parameters
$kind | ElementKind | A column or an index |
$from | ColumnName | The current name |
$to | ColumnName | The new name |
Calls 3
- static-call Check::input() line 38
- class-const ElementKind::Column() line 38
- class-const ElementKind::Index() line 38
public function deriveCommand(Derivation $derivation, Environment $scope): voidDerives nothing: the action holds no expression.
Parameters
$derivation | Derivation | |
$scope | Environment |
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
RenameElementTestcalls