Permalink
Browse files

Updating Schema shell so before() and after() are properly triggered. F…

…ixes #5918

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7952 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information...
markstory committed Dec 23, 2008
1 parent 61850b1 commit 0c29a7e1b1f16329e0eb3e7b3b7cd88fe534e4b8
Showing with 6 additions and 6 deletions.
  1. +6 −6 cake/console/libs/schema.php
@@ -305,15 +305,15 @@ function __create($Schema, $table = null) {
if ('y' == $this->in(__('Are you sure you want to drop the table(s)?', true), array('y', 'n'), 'n')) {
$this->out('Dropping table(s).');
- $this->__run($drop, 'drop');
+ $this->__run($drop, 'drop', $Schema);
}
$this->out("\n" . __('The following table(s) will be created.', true));
$this->out(array_keys($create));
if ('y' == $this->in(__('Are you sure you want to create the table(s)?', true), array('y', 'n'), 'y')) {
$this->out('Creating table(s).');
- $this->__run($create, 'create');
+ $this->__run($create, 'create', $Schema);
}
$this->out(__('End create.', true));
@@ -351,7 +351,7 @@ function __update($Schema, $table = null) {
if ('y' == $this->in(__('Are you sure you want to alter the tables?', true), array('y', 'n'), 'n')) {
$this->out('');
$this->out(__('Updating Database...', true));
- $this->__run($contents, 'update');
+ $this->__run($contents, 'update', $Schema);
}
$this->out(__('End update.', true));
@@ -361,7 +361,7 @@ function __update($Schema, $table = null) {
*
* @access private
*/
- function __run($contents, $event) {
+ function __run($contents, $event, $Schema) {
if (empty($contents)) {
$this->err(__('Sql could not be run', true));
return;
@@ -379,14 +379,14 @@ function __run($contents, $event) {
$this->out(sprintf(__('Dry run for %s :', true), $table));
$this->out($sql);
} else {
- if (!$this->Schema->before(array($event => $table))) {
+ if (!$Schema->before(array($event => $table))) {
return false;
}
if (!$db->_execute($sql)) {
$error = $table . ': ' . $db->lastError();
}
- $this->Schema->after(array($event => $table, 'errors'=> $errors));
+ $Schema->after(array($event => $table, 'errors'=> $errors));
if (isset($error)) {
$this->out($error);

0 comments on commit 0c29a7e

Please sign in to comment.