From 67a4d16038cbf30220b548d31f178d4f7d7b5639 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 7 Jan 2019 08:42:39 +1300 Subject: [PATCH] Fix #358 check index exists before dropping. --- db/upgrade.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/upgrade.php b/db/upgrade.php index 06d955b..7285815 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -413,7 +413,9 @@ function xmldb_attendance_upgrade($oldversion=0) { $table = new xmldb_table('attendance_warning_done'); $index = new xmldb_index('notifyid_userid', XMLDB_INDEX_UNIQUE, array('notifyid', 'userid')); - $dbman->drop_index($table, $index); + if ($dbman->index_exists($table, $index)) { + $dbman->drop_index($table, $index); + } $index = new xmldb_index('notifyid', XMLDB_INDEX_NOTUNIQUE, array('notifyid', 'userid')); $dbman->add_index($table, $index);