src/Charcoal/Admin/Script/Object/Table/AlterPrimaryKeyScript.php
private function renameColumn(PropertyField $field, $from, $to)
    {
        $model  = $this->targetModel();
        $source = $model->source();

        $field->setIdent($to);
        $sql = strtr(
            'ALTER TABLE `%table` CHANGE COLUMN `%from` %field',
            [
                '%table' => $source->table(),
                '%field' => $field->sql(),
                '%from'  => $from,
                '%to'    => $to,
            ]
        );
        $source->db()->query($sql);

        return $this;
    }
private function renameColumn(PropertyField $field, $from, $to)
    {
        $model  = $this->targetModel();
        $source = $model->source();

        $field->setIdent($to);
        $sql = strtr(
            'ALTER TABLE `%table` CHANGE COLUMN `%from` %field',
            [
                '%table' => $source->table(),
                '%field' => $field->sql(),
                '%from'  => $from,
                '%to'    => $to,
            ]
        );
        $source->db()->query($sql);

        return $this;
    }
private function renameColumn ( PropertyField $ field , $ from , $ to ) { $ model = $ this -> targetModel ( ) ; $ source = $ model -> source ( ) ; $ field -> setIdent ( $ to ) ; $ sql = strtr ( 'ALTER TABLE `%table` CHANGE COLUMN `%from` %field' , [ '%table' => $ source -> table ( ) , '%field' => $ field -> sql ( ) , '%from' => $ from , '%to' => $ to , ] ) ; $ source -> db ( ) -> query ( $ sql ) ; return $ this ; }
Rename the given field.

@param  PropertyField $field The field to rename.
@param  string        $from  The original field key.
@param  string        $to    The new field key.
@return self
Rename the given field .