Skip to content

Commit

Permalink
Fixing error string passing in SchemaShell::__run() Fixes #45
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 22, 2009
1 parent 3f0f4b9 commit 98ad480
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cake/console/libs/schema.php
Expand Up @@ -369,8 +369,7 @@ function __run($contents, $event, $Schema) {
Configure::write('debug', 2);
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db->fullDebug = true;

$errors = array();

foreach ($contents as $table => $sql) {
if (empty($sql)) {
$this->out(sprintf(__('%s is up to date.', true), $table));
Expand All @@ -382,15 +381,16 @@ function __run($contents, $event, $Schema) {
if (!$Schema->before(array($event => $table))) {
return false;
}
if (!$db->_execute($sql)) {
$error = null;
if (!$db->execute($sql)) {
$error = $table . ': ' . $db->lastError();
}

$Schema->after(array($event => $table, 'errors'=> $errors));
$Schema->after(array($event => $table, 'errors' => $error));

if (isset($error)) {
if (!empty($error)) {
$this->out($error);
} elseif ($this->__dry !== true) {
} else {
$this->out(sprintf(__('%s updated.', true), $table));
}
}
Expand Down

0 comments on commit 98ad480

Please sign in to comment.