Skip to content

Commit

Permalink
Fix issue #98 to add a key
Browse files Browse the repository at this point in the history
  • Loading branch information
TomoTsuyuki authored and timhunt committed Nov 26, 2021
1 parent 05b24f4 commit 7d7e37a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,18 @@ function xmldb_report_customsql_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2021051000, 'report', 'customsql');
}

if ($oldversion < 2021111600) {
// Define index usermodified to be added to report_customsql_queries.
$table = new xmldb_table('report_customsql_queries');
// Conditionally launch add key usermodified.
if (!$table->getKey('usermodified')) {
$key = new xmldb_key('usermodified', XMLDB_KEY_FOREIGN, ['usermodified'], 'user', ['id']);
$dbman->add_key($table, $key);
}

// Customsql savepoint reached.
upgrade_plugin_savepoint(true, 2021111600, 'report', 'customsql');
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2021070700;
$plugin->version = 2021111600;
$plugin->requires = 2020061500;
$plugin->component = 'report_customsql';
$plugin->maturity = MATURITY_STABLE;
Expand Down

0 comments on commit 7d7e37a

Please sign in to comment.