Skip to content

Commit 2fe877e

Browse files
committed
Adding method to compare tableParameters in the Schema, so they no longer fall through as fields.
1 parent 0fc6f58 commit 2fe877e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

cake/libs/model/cake_schema.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,11 @@ function compare($old, $new = null) {
496496
}
497497
}
498498
if (isset($old[$table]['tableParameters']) && isset($new[$table]['tableParameters'])) {
499-
499+
$diff = $this->_compareTableParameters($new[$table]['tableParameters'], $old[$table]['tableParameters']);
500+
if ($diff) {
501+
$tables[$table]['drop']['tableParameters'] = $diff['drop'];
502+
$tables[$table]['add']['tableParameters'] = $diff['add'];
503+
}
500504
}
501505
}
502506
return $tables;
@@ -567,6 +571,17 @@ function __columns(&$Obj) {
567571
return $columns;
568572
}
569573

574+
/**
575+
* Compare two schema files table Parameters
576+
*
577+
* @param array $new New indexes
578+
* @param array $old Old indexes
579+
* @return mixed False on failure, or an array of parameters to add & drop.
580+
**/
581+
function _compareTableParameters($new, $old) {
582+
583+
}
584+
570585
/**
571586
* Compare two schema indexes
572587
*

cake/tests/cases/libs/model/cake_schema.test.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ function testSchemaComparison() {
546546
),
547547
'drop' => array(
548548
'article_id' => array('type' => 'integer', 'null' => false),
549-
'tableParameters' => array()
550549
),
551550
'change' => array(
552551
'comment' => array('type' => 'text', 'null' => false, 'default' => null)

0 commit comments

Comments
 (0)