Adding isset() checks for CakeSchema::compare() when diff'ing db indexes.

Allows for slightly better interoperability between schemas generated with CakePHP 1.2 and with 1.3
This commit is contained in:
Joël Perras 2010-01-07 17:49:57 -05:00
parent 026eeb645b
commit 730153b151

View file

@ -168,7 +168,7 @@ class CakeSchema extends Object {
* Reads database and creates schema tables
*
* Options
*
*
* - 'connection' - the db connection to use
* - 'name' - name of the schema
* - 'models' - a list of models to use, or false to ignore models
@ -428,8 +428,12 @@ class CakeSchema extends Object {
if (isset($old[$table]['indexes']) && isset($new[$table]['indexes'])) {
$diff = $this->_compareIndexes($new[$table]['indexes'], $old[$table]['indexes']);
if ($diff) {
$tables[$table]['drop']['indexes'] = $diff['drop'];
$tables[$table]['add']['indexes'] = $diff['add'];
if (isset($tables[$table]['drop']['indexes']) && isset($diff['drop'])) {
$tables[$table]['drop']['indexes'] = $diff['drop'];
}
if (isset($tables[$table]['add']['indexes']) && isset($diff['add'])) {
$tables[$table]['add']['indexes'] = $diff['add'];
}
}
}
}