cakephp / migrations

CakePHP database migrations plugin
Other
138 stars 116 forks source link

Table::renameColumn is not supported #501

Closed DJAxel closed 3 years ago

DJAxel commented 3 years ago

This is a (multiple allowed):

What you did

I wanted to rename a column. The Phinx documentation reads that is can bhe done with the Table::renameColumn() method. The CakePHP Migrations wrapper doesn't seem to support this.

<?php
declare(strict_types=1);

use Migrations\AbstractMigration;

class FlightplanRequester extends AbstractMigration
{
    public function change()
    {
        $this->table('flightplans')
            ->renameColumn('pic_id', 'requester_id');
    }
}

Expected Behavior

The migration succeeds, column flightplans.pic_id is renamed to flightplans.requester_id.

The CakePHP Migrations documentation states that it is a wrapper for Phinx. I would expect the wrapper to inherit this behaviour and execute the same functionality.

Actual Behavior

The migration succeeds, but the column flightplans.pic_id is not renamed.

DJAxel commented 3 years ago

Forgot to call Table::update() 🤦‍♂️