Skip to content

Commit

Permalink
prevent error for unnecessary not null alter statments
Browse files Browse the repository at this point in the history
  • Loading branch information
butonic committed Jun 6, 2013
1 parent 3ddbf7a commit d59b017
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions MDB2/Driver/Manager/oci8.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,15 @@ function alterTable($name, $changes, $check)
if (!array_key_exists('notnull', $field)) {
unset($field['definition']['notnull']);
}
if (array_key_exists('notnull', $field)
&& $field['notnull']
&& array_key_exists('notnull', $field['definition'])
&& $field['definition']['notnull']
) {
//ignore not null constraint to fix "column to be modified to NOT NULL is already NOT NULL"
unset($field['definition']['notnull']);
unset($field['notnull']);
}
$fields[] = $db->getDeclaration($field['definition']['type'], $field_name, $field['definition']);
}
$result = $db->exec("ALTER TABLE $name MODIFY (". implode(', ', $fields).')');
Expand Down

0 comments on commit d59b017

Please sign in to comment.