Skip to content

Commit

Permalink
Skip column modification if result would be the same.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Feb 24, 2014
1 parent e9e434d commit d03026b
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions framework/Db/lib/Horde/Db/Adapter/Oracle/Schema.php
Expand Up @@ -444,6 +444,24 @@ public function changeColumn($tableName, $columnName, $type, $options = array())
return;
}

$old = $this->typeToSql(
$column->getType(),
is_null($options['limit']) ? null : $column->getLimit(),
is_null($options['precision']) ? null : $column->precision(),
is_null($options['scale']) ? null : $column->scale(),
is_null($options['unsigned']) ? null : $column->isUnsigned()
);
$new = $this->typeToSql(
$type,
$options['limit'],
$options['precision'],
$options['scale'],
$options['unsigned']
);
if ($old == $new) {
return;
}

if ($type == 'autoincrementKey') {
try {
$this->removePrimaryKey($tableName);
Expand Down Expand Up @@ -511,15 +529,7 @@ public function changeColumn($tableName, $columnName, $type, $options = array())
return;
}

$sql = $this->quoteColumnName($columnName)
. ' '
. $this->typeToSql(
$type,
$options['limit'],
$options['precision'],
$options['scale'],
$options['unsigned']
);
$sql = $this->quoteColumnName($columnName) . ' ' . $new;
$sql = $this->addColumnOptions($sql, $options);

$sql = sprintf(
Expand Down

0 comments on commit d03026b

Please sign in to comment.