Skip to content
Snippets Groups Projects
Commit 64b35eda authored by ='s avatar =
Browse files

MBS-4967: Adding check for index_exists to upgrade.php

parent 77dd8cf1
No related branches found
No related tags found
No related merge requests found
...@@ -528,7 +528,9 @@ function hvp_upgrade_2020091500() { ...@@ -528,7 +528,9 @@ function hvp_upgrade_2020091500() {
$dbman = $DB->get_manager(); $dbman = $DB->get_manager();
$table = new xmldb_table('hvp_xapi_results'); $table = new xmldb_table('hvp_xapi_results');
$index = new xmldb_index('results', XMLDB_INDEX_NOTUNIQUE, ['content_id', 'user_id']); $index = new xmldb_index('results', XMLDB_INDEX_NOTUNIQUE, ['content_id', 'user_id']);
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index); $dbman->add_index($table, $index);
}
$oldindex = new xmldb_index('result', XMLDB_INDEX_UNIQUE, ['id', 'content_id', 'user_id']); $oldindex = new xmldb_index('result', XMLDB_INDEX_UNIQUE, ['id', 'content_id', 'user_id']);
$dbman->drop_index($table, $oldindex); $dbman->drop_index($table, $oldindex);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment