[DMIG-31] $table->renameColumn() actually drops the column Created: 23/Dec/11  Updated: 19/Jun/12  Resolved: 04/Jun/12

Status: Resolved
Project: Doctrine Migrations
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Nikola Petkanski Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None
Environment:

symfony 2.0.7



 Description   

Tried to use renameColumn() into one of my migration scripts and it dropped the table.

The code does not seem okay as well:

namespace Doctrine\DBAL\Schema;
..
class Table extends AbstractAsset
{
..
  /**
    * Rename Column
    *
    * @param string $oldColumnName
    * @param string $newColumnName
    * @return Table
    */
public function renameColumn($oldColumnName, $newColumnName)
{
    $column = $this->getColumn($oldColumnName);
    $this->dropColumn($oldColumnName);

    $column->_setName($newColumnName);
    return $this;
}
..


 Comments   
Comment by Tyler Sommer [ 06/Feb/12 ]

Doctrine\DBAL\Schema\Table is actually not a part of Doctrine Migrations, rather just the Database Abstraction Layer project. Recommend this gets sorted as such.

Comment by David Buchmann [ 04/Jun/12 ]

this is a duplicate of DMIG-22

any chances of getting the issue fixed?

Comment by Benjamin Eberlei [ 04/Jun/12 ]

From the internals this is really complicated. I will delete the method instead.

Comment by Gonzalo Sainz-Trapaga [ 19/Jun/12 ]

Does this mean Doctrine Migrations won't support renaming columns? I'm sorry but the alternative of not supporting it at all doesn't really work. It's a basic operation for DB schema changes, which are the whole point of migrations. What exactly is the proble? I have seen the algorithms for inferring that a column or table should be renamed and they are pretty simplistic. Maybe the solution is adding some sort of hinting to the renameX operations so that there is metadata inside the Table Schemas saying what the original columns or tables were. Thoughts?

Generated at Mon Dec 22 03:37:04 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.