diff options
author | William Desportes <williamdes@wdes.fr> | 2021-03-24 05:00:42 +0300 |
---|---|---|
committer | William Desportes <williamdes@wdes.fr> | 2021-03-24 05:09:57 +0300 |
commit | 52b872feb8d21d8654a265525fdaed7c5632b74f (patch) | |
tree | 4b74f446352f310313d04533769bebe4a491941a /libraries/classes/Table.php | |
parent | 970d28617a48540c2c9432d0f807ba2fe36071e7 (diff) | |
parent | b8540bdc3c1bfe6ff704135ec5b8d8dfcb47f288 (diff) |
Merge #16737 - Fix #16728 - Wrong SQL query built on table structure index for new column
Pull-request: #16737
Fixes: #16728
Signed-off-by: William Desportes <williamdes@wdes.fr>
Diffstat (limited to 'libraries/classes/Table.php')
-rw-r--r-- | libraries/classes/Table.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libraries/classes/Table.php b/libraries/classes/Table.php index c1a75ccc04..7ef99341ed 100644 --- a/libraries/classes/Table.php +++ b/libraries/classes/Table.php @@ -2229,12 +2229,13 @@ class Table // Drops the old index if (! empty($_POST['old_index'])) { - if ($_POST['old_index'] === 'PRIMARY') { + $oldIndex = is_array($_POST['old_index']) ? $_POST['old_index']['Key_name'] : $_POST['old_index']; + if ($oldIndex === 'PRIMARY') { $sql_query .= ' DROP PRIMARY KEY,'; } else { $sql_query .= sprintf( ' DROP INDEX %s,', - Util::backquote($_POST['old_index']) + Util::backquote($oldIndex) ); } } |