Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

… Fixes #5918

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7952 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information...
commit 0c29a7e1b1f16329e0eb3e7b3b7cd88fe534e4b8 1 parent 61850b1
@markstory markstory authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 cake/console/libs/schema.php
View
12 cake/console/libs/schema.php
@@ -305,7 +305,7 @@ 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));
@@ -313,7 +313,7 @@ function __create($Schema, $table = null) {
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);
Please sign in to comment.
Something went wrong with that request. Please try again.