mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
Adding method to compare tableParameters in the Schema, so they no longer fall through as fields.
This commit is contained in:
parent
0fc6f58cfb
commit
2fe877e527
2 changed files with 16 additions and 2 deletions
|
@ -496,7 +496,11 @@ class CakeSchema extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($old[$table]['tableParameters']) && isset($new[$table]['tableParameters'])) {
|
if (isset($old[$table]['tableParameters']) && isset($new[$table]['tableParameters'])) {
|
||||||
|
$diff = $this->_compareTableParameters($new[$table]['tableParameters'], $old[$table]['tableParameters']);
|
||||||
|
if ($diff) {
|
||||||
|
$tables[$table]['drop']['tableParameters'] = $diff['drop'];
|
||||||
|
$tables[$table]['add']['tableParameters'] = $diff['add'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $tables;
|
return $tables;
|
||||||
|
@ -567,6 +571,17 @@ class CakeSchema extends Object {
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two schema files table Parameters
|
||||||
|
*
|
||||||
|
* @param array $new New indexes
|
||||||
|
* @param array $old Old indexes
|
||||||
|
* @return mixed False on failure, or an array of parameters to add & drop.
|
||||||
|
**/
|
||||||
|
function _compareTableParameters($new, $old) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two schema indexes
|
* Compare two schema indexes
|
||||||
*
|
*
|
||||||
|
|
|
@ -546,7 +546,6 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
),
|
),
|
||||||
'drop' => array(
|
'drop' => array(
|
||||||
'article_id' => array('type' => 'integer', 'null' => false),
|
'article_id' => array('type' => 'integer', 'null' => false),
|
||||||
'tableParameters' => array()
|
|
||||||
),
|
),
|
||||||
'change' => array(
|
'change' => array(
|
||||||
'comment' => array('type' => 'text', 'null' => false, 'default' => null)
|
'comment' => array('type' => 'text', 'null' => false, 'default' => null)
|
||||||
|
|
Loading…
Add table
Reference in a new issue