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.

Renaming a columndoctest
$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 $kind
public ColumnName $from

Methods§

public function __construct(
    public ElementKind $kind,
    public ColumnName $from,
    public ColumnName $to,
)

Parameters

$kindElementKindA column or an index
$fromColumnNameThe current name
$toColumnNameThe new name
Calls 3
public function deriveCommand(Derivation $derivation, Environment $scope): void

Derives nothing: the action holds no expression.

Parameters

$derivationDerivation
$scopeEnvironment
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