From d6cc1fa5b292871a2ec2d74f7155d72cf73daded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Kr=C3=A4mer?= Date: Tue, 5 Aug 2014 16:47:00 +0200 Subject: [PATCH] Fixing https://github.com/CakeDC/migrations/issues/140 Migration run dry is not equal to run in real --- Lib/CakeMigration.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/CakeMigration.php b/Lib/CakeMigration.php index 3a5acade..b55bac22 100644 --- a/Lib/CakeMigration.php +++ b/Lib/CakeMigration.php @@ -431,7 +431,7 @@ protected function _alterTable($type, $tables) { $tableFields = $this->db->describe($model); $tableFields['indexes'] = $this->db->index($model); $tableFields['tableParameters'] = $this->db->readTableParameters($this->db->fullTableName($model, false, false)); - + if ($type === 'drop') { $field = $col; } @@ -442,6 +442,7 @@ protected function _alterTable($type, $tables) { $data = array('table' => $table, 'field' => $field); } $callbackData = $data; + if ($this->_invokePrecheck('beforeAction', $type . '_field', $data)) { switch ($type) { case 'add': @@ -480,7 +481,7 @@ protected function _alterTable($type, $tables) { if ($this->dry) { $this->logQuery($sql); - return true; + continue; } $this->_invokeCallbacks('beforeAction', $type . '_field', $callbackData); @@ -489,6 +490,9 @@ protected function _alterTable($type, $tables) { } $this->_invokeCallbacks('afterAction', $type . '_field', $callbackData); } + if ($this->dry) { + return true; + } } if ($type !== 'drop') {