From 87d58d996416a7106c20ce4aed70692152b1fd47 Mon Sep 17 00:00:00 2001 From: samw3 Date: Thu, 8 Nov 2007 17:10:08 +0000 Subject: [PATCH] fixed processRenamedColumns() to work with mysql migrations --- lib/Doctrine/Migration/Process.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/Migration/Process.php b/lib/Doctrine/Migration/Process.php index 5847138dd..5cd7bdc78 100644 --- a/lib/Doctrine/Migration/Process.php +++ b/lib/Doctrine/Migration/Process.php @@ -116,9 +116,14 @@ class Doctrine_Migration_Process public function processRenamedColumns($columns) { foreach ($columns as $column) { - $conn = $this->getConnection($column['tableName']); - - $conn->export->alterTable($column['tableName'], array('rename' => array($column['oldColumnName'] => array('name' => $column['newColumnName'])))); + $conn = $this->getConnection($column['tableName']); + + $columnList = $conn->import->listTableColumns($column['tableName']); + if (isset($columnList[$column['oldColumnName']])) { + $conn->export->alterTable($column['tableName'], + array('rename' => array($column['oldColumnName'] => array('name' => $column['newColumnName'], + 'definition'=>$columnList[$column['oldColumnName']])))); + } } }