From a8fe168e08a302a170e935d3629b988813f6cf1e Mon Sep 17 00:00:00 2001 From: Derek Henderson Date: Tue, 10 Jan 2017 15:08:17 -0500 Subject: [PATCH] MDL-55652 grades: Added timemodified as index grade tables Added timemodified to grade_categories_history, grade_items_history, grade_outcomes_history,and scale_history. --- lib/db/install.xml | 6 +++++- lib/db/upgrade.php | 35 +++++++++++++++++++++++++++++++++++ version.php | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index bd36ac76690..e172216b5b1 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -815,6 +815,7 @@ + @@ -1816,6 +1817,7 @@ +
@@ -1848,6 +1850,7 @@ +
@@ -1898,6 +1901,7 @@ +
@@ -3721,4 +3725,4 @@
- \ No newline at end of file + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index d0fb99f05b2..204a8ebb990 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2601,5 +2601,40 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2017092900.00); } + if ($oldversion < 2017092901.00) { + // Add index on time modified to grade_outcomes_history, grade_categories_history, + // grade_items_history, and scale_history. + $table = new xmldb_table('grade_outcomes_history'); + $index = new xmldb_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified')); + + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + $table = new xmldb_table('grade_items_history'); + $index = new xmldb_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified')); + + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + $table = new xmldb_table('grade_categories_history'); + $index = new xmldb_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified')); + + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + $table = new xmldb_table('scale_history'); + $index = new xmldb_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified')); + + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2017092901.00); + } + return true; } diff --git a/version.php b/version.php index 5c7c36ee491..3ffa453451f 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2017092900.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2017092901.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.