Permalink
Browse files

profiles MDL-17201 added an index to user_info_data table

  • Loading branch information...
1 parent 14a4e75 commit 73c07a1f72e890730caaa6816f892042d6c5e607 @andyjdavis andyjdavis committed Jan 25, 2011
Showing with 21 additions and 1 deletion.
  1. +3 −0 lib/db/install.xml
  2. +17 −0 lib/db/upgrade.php
  3. +1 −1 version.php
View
3 lib/db/install.xml
@@ -933,6 +933,9 @@
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="userfieldidx" UNIQUE="false" FIELDS="userid, fieldid"/>
+ </INDEXES>
</TABLE>
<TABLE NAME="mnet_enrol_course" COMMENT="Information about courses on remote hosts" PREVIOUS="user_info_data" NEXT="mnet_enrol_assignments">
<FIELDS>
View
17 lib/db/upgrade.php
@@ -3351,6 +3351,23 @@ function xmldb_main_upgrade($oldversion=0) {
set_config('filter_mediaplugin_enable_ogg', 1);
upgrade_main_savepoint($result, 2007101590.01);
}
+
+ if ($result && $oldversion < 2007101591.01) {
+
+ /// Define index userfieldidx (not unique) to be added to user_info_data
+ $table = new XMLDBTable('user_info_data');
+ $index = new XMLDBIndex('userfieldidx');
+ $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('userid', 'fieldid'));
+
+ /// Launch add index userfieldidx
+ if (!index_exists($table, $index)) {
+ $result = $result && add_index($table, $index);
+ }
+
+ /// Main savepoint reached
+ upgrade_main_savepoint($result, 2007101591.01);
+ }
+
return $result;
}
View
2 version.php
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2007101591.00; // YYYYMMDD = date of the 1.9 branch (don't change)
+ $version = 2007101591.01; // YYYYMMDD = date of the 1.9 branch (don't change)
// X = release number 1.9.[0,1,2,3,4,5...]
// Y.YY = micro-increments between releases

0 comments on commit 73c07a1

Please sign in to comment.