Permalink
Browse files

Quick and dirty fix for the error occurring when changing table param…

…s (issue #32)
  • Loading branch information...
1 parent 409610a commit 60a4eeb41d392cd52cadcc2985da5ab2534b0783 @ok32 committed Nov 3, 2011
Showing with 15 additions and 7 deletions.
  1. +15 −7 libs/model/cake_migration.php
@@ -327,10 +327,12 @@ protected function _alterTable($type, $tables) {
if ($type === 'drop') {
$field = $col;
}
- if ($type !== 'add' && !isset($tableFields[$field])) {
- throw new MigrationException($this, sprintf(
- __d('migrations', 'Field "%s" does not exists in "%s".', true), $field, $table
- ));
+ if ($field != 'tableParameters') {
+ if ($type !== 'add' && !isset($tableFields[$field])) {
+ throw new MigrationException($this, sprintf(
+ __d('migrations', 'Field "%s" does not exists in "%s".', true), $field, $table
+ ));
+ }
}
switch ($type) {
@@ -350,9 +352,15 @@ protected function _alterTable($type, $tables) {
));
break;
case 'change':
- $sql = $this->db->alterSchema(array(
- $table => array('change' => array($field => array_merge($tableFields[$field], $col)))
- ));
+ if ($field == 'tableParameters') {
+ $sql = $this->db->alterSchema(array(
+ $table => array('change' => array($field => $col))
+ ));
+ } else {
+ $sql = $this->db->alterSchema(array(
+ $table => array('change' => array($field => array_merge($tableFields[$field], $col)))
+ ));
+ }
break;
case 'rename':
$sql = $this->db->alterSchema(array(

0 comments on commit 60a4eeb

Please sign in to comment.