Skip to content

Commit

Permalink
Avoid errors when alter table column
Browse files Browse the repository at this point in the history
Signed-off-by: Takashi SHIRAI <[email protected]>
  • Loading branch information
Takashi SHIRAI authored and vrana committed Feb 9, 2021
1 parent 68edea5 commit 98458f7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions adminer/drivers/oracle.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,19 @@ function auto_increment() {

function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
$alter = $drop = array();
$orig_fields = ($table ? fields($table) : array());
foreach ($fields as $field) {
$val = $field[1];
if ($val && $field[0] != "" && idf_escape($field[0]) != $val[0]) {
queries("ALTER TABLE " . table($table) . " RENAME COLUMN " . idf_escape($field[0]) . " TO $val[0]");
}
$orig_field = $orig_fields[$field[0]];
if ($val && $orig_field) {
$old = process_field($orig_field, $orig_field);
if ($val[2] == $old[2]) {
$val[2] = "";
}
}
if ($val) {
$alter[] = ($table != "" ? ($field[0] != "" ? "MODIFY (" : "ADD (") : " ") . implode($val) . ($table != "" ? ")" : ""); //! error with name change only
} else {
Expand Down

0 comments on commit 98458f7

Please sign in to comment.