mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Adding one new index to cache_text table. User to make cron deletion
of expired records faster. MDL-11605
This commit is contained in:
parent
c8149f0f4f
commit
cef1ea8e8e
@ -264,7 +264,8 @@
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="md5key" UNIQUE="false" FIELDS="md5key"/>
|
||||
<INDEX NAME="md5key" UNIQUE="false" FIELDS="md5key" NEXT="timemodified"/>
|
||||
<INDEX NAME="timemodified" UNIQUE="false" FIELDS="timemodified" COMMENT="Mainly to help deletion of expired records from cron" PREVIOUS="md5key"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="grade_category" COMMENT="to define categories to group activity grades" PREVIOUS="cache_text" NEXT="grade_exceptions">
|
||||
|
@ -2400,6 +2400,21 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
$result = $result && drop_table($table);
|
||||
}
|
||||
|
||||
/// Truncate the text_cahe table and add new index
|
||||
if ($result && $oldversion < 2007100802) {
|
||||
|
||||
/// Truncate the cache_text table
|
||||
execute_sql("TRUNCATE TABLE {$CFG->prefix}cache_text", true);
|
||||
|
||||
/// Define index timemodified (not unique) to be added to cache_text
|
||||
$table = new XMLDBTable('cache_text');
|
||||
$index = new XMLDBIndex('timemodified');
|
||||
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
|
||||
|
||||
/// Launch add index timemodified
|
||||
$result = $result && add_index($table, $index);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user