Skip to content
Snippets Groups Projects
Unverified Commit 775c9cae authored by Svein-Tore Griff With's avatar Svein-Tore Griff With Committed by GitHub
Browse files

Merge pull request #440 from mebis-lp/MBS-4967_issue_with_index_already_exist

MBS-4967: Adding check for index_exists to upgrade.php
parents 134b86bf 64b35eda
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