public function alterTable($options)
{
$options = array_merge(array('dropField' => true), $options);
extract($options);
if (!isset($old) || !isset($new)) {
return false;
}
$Schema = ClassRegistry::init('CakeSchema');
$Schema->connection = $this->configKeyName;
$compare = $Schema->compare($old, $new);
if (!$dropField) {
foreach ($compare as $table => $alter) {
foreach ($alter as $method => $field) {
if ($method == 'drop') {
unset($compare[$table]['drop']);
break;
}
}
}
}
$sql = $this->alterSchema($compare);
if ($sql) {
$return = $this->execute($sql);
// とりあえずキャッシュを全て削除
clearCache(null, 'models');
return $return;
} else {
return false;
}
}