mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-53296_master tool_lp: Add unique index in course_competency
This commit is contained in:
parent
d61035968d
commit
b986597039
3 changed files with 15 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="admin/tool/lp/db" VERSION="20160304" COMMENT="XMLDB file for Moodle admin/tool/lp"
|
||||
<XMLDB PATH="admin/tool/lp/db" VERSION="20160305" COMMENT="XMLDB file for Moodle admin/tool/lp"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
|
@ -73,6 +73,7 @@
|
|||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="courseidruleoutcome" UNIQUE="false" FIELDS="courseid, ruleoutcome"/>
|
||||
<INDEX NAME="courseidcompetencyid" UNIQUE="true" FIELDS="courseid, competencyid"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="tool_lp_plan" COMMENT="Learning plans">
|
||||
|
|
|
@ -820,5 +820,17 @@ function xmldb_tool_lp_upgrade($oldversion) {
|
|||
upgrade_plugin_savepoint(true, 2016020913, 'tool', 'lp');
|
||||
}
|
||||
|
||||
if ($oldversion < 2016020917) {
|
||||
// Define index courseidcompetencyid (unique) to be added to tool_lp_course_competency.
|
||||
$table = new xmldb_table('tool_lp_course_competency');
|
||||
$index = new xmldb_index('courseidcompetencyid', XMLDB_INDEX_UNIQUE, array('courseid', 'competencyid'));
|
||||
// Conditionally launch add index cmidcompetencyid.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
// Lp savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2016020917, 'tool', 'lp');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue