Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Duplicate
-
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;
}
..
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?