Skip to content

Commit

Permalink
Merge branch 'MDL-61605' of https://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Mar 20, 2018
2 parents 4dca6ab + d9b80a5 commit bb0ca2c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mod/quiz/report/overview/db/install.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/quiz/report/overview/db" VERSION="20120122" COMMENT="XMLDB file for Moodle mod/quiz/report/overview"
<XMLDB PATH="mod/quiz/report/overview/db" VERSION="20180319" COMMENT="XMLDB file for Moodle mod/quiz/report/overview"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../lib/xmldb/xmldb.xsd"
>
Expand All @@ -16,6 +16,7 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="questionusageid-slot" TYPE="foreign-unique" FIELDS="questionusageid, slot" REFTABLE="question_attempts" REFFIELDS="questionusageid, slot"/>
</KEYS>
</TABLE>
</TABLES>
Expand Down
17 changes: 16 additions & 1 deletion mod/quiz/report/overview/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
* @param number $oldversion
*/
function xmldb_quiz_overview_upgrade($oldversion) {
global $CFG;
global $DB;

$dbman = $DB->get_manager();

// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
Expand All @@ -40,5 +42,18 @@ function xmldb_quiz_overview_upgrade($oldversion) {
// Automatically generated Moodle v3.4.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2018021800) {

// Define key questionusageid-slot (foreign-unique) to be added to quiz_overview_regrades.
$table = new xmldb_table('quiz_overview_regrades');
$key = new xmldb_key('questionusageid-slot', XMLDB_KEY_FOREIGN_UNIQUE, array('questionusageid', 'slot'), 'question_attempts', array('questionusageid', 'slot'));

// Launch add key questionusageid-slot.
$dbman->add_key($table, $key);

// Overview savepoint reached.
upgrade_plugin_savepoint(true, 2018021800, 'quiz', 'overview');
}

return true;
}
2 changes: 1 addition & 1 deletion mod/quiz/report/overview/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

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

$plugin->version = 2017111300;
$plugin->version = 2018021800;
$plugin->requires = 2017110800;
$plugin->component = 'quiz_overview';

0 comments on commit bb0ca2c

Please sign in to comment.