From 730153b1516f368a73dcae8efcfa025b9187b062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Perras?= Date: Thu, 7 Jan 2010 17:49:57 -0500 Subject: [PATCH] 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 --- cake/libs/model/schema.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cake/libs/model/schema.php b/cake/libs/model/schema.php index d607dbf57..d1a455290 100644 --- a/cake/libs/model/schema.php +++ b/cake/libs/model/schema.php @@ -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']; + } } } }