Skip to content
Browse files

MDL-31557 Add index for timemodified in grade_grades_history table

  • Loading branch information...
1 parent f29e62c commit e1580085c437445822061a795b1b3a1559a6774c Tim Gus committed with markn86 Jan 4, 2013
Showing with 19 additions and 2 deletions.
  1. +2 −1 lib/db/install.xml
  2. +16 −0 lib/db/upgrade.php
  3. +1 −1 version.php
View
3 lib/db/install.xml
@@ -1983,7 +1983,8 @@
<KEY NAME="loggeduser" TYPE="foreign" FIELDS="loggeduser" REFTABLE="user" REFFIELDS="id"/>
</KEYS>
<INDEXES>
- <INDEX NAME="action" UNIQUE="false" FIELDS="action" COMMENT="insert/update/delete"/>
+ <INDEX NAME="action" UNIQUE="false" FIELDS="action" COMMENT="insert/update/delete" NEXT="timemodified"/>
+ <INDEX NAME="timemodified" UNIQUE="false" FIELDS="timemodified" PREVIOUS="action"/>
</INDEXES>
</TABLE>
<TABLE NAME="grade_import_newitem" COMMENT="temporary table for storing new grade_item names from grade import">
View
16 lib/db/upgrade.php
@@ -1660,5 +1660,21 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2013021902.00);
}
+ // Add index to field "timemodified" for grade_grades_history table.
+ if ($oldversion < 2013022200.01) {
+ $table = new xmldb_table('grade_grades_history');
+ $field = new xmldb_field('timemodified');
+
+ if ($dbman->field_exists($table, $field)) {
+ $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, 2013022200.01);
+ }
+
return true;
}
View
2 version.php
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2013022200.00; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2013022200.01; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit e158008

Please sign in to comment.
Something went wrong with that request. Please try again.