MDL-53452 tool_lp: Make course comp settings table have a unique foreign key

This commit is contained in:
Damyon Wiese
2016-04-18 10:59:00 +08:00
committed by Frederic Massart
parent 14b60a440c
commit 35cf63d221
2 changed files with 5 additions and 10 deletions
Regular → Executable
+4 -7
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="admin/tool/lp/db" VERSION="20160305" COMMENT="XMLDB file for Moodle admin/tool/lp"
<XMLDB PATH="admin/tool/lp/db" VERSION="20160329" COMMENT="XMLDB file for Moodle admin/tool/lp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
@@ -43,11 +43,8 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="courseidlink" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id" COMMENT="Course foreign key."/>
<KEY NAME="courseidlink" TYPE="foreign-unique" FIELDS="courseid" REFTABLE="course" REFFIELDS="id" COMMENT="Course foreign key."/>
</KEYS>
<INDEXES>
<INDEX NAME="courseiduniq" UNIQUE="true" FIELDS="courseid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_competency_framework" COMMENT="List of competency frameworks.">
<FIELDS>
@@ -330,7 +327,7 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="cmidkey" TYPE="foreign" FIELDS="cmid" REFTABLE="id" REFFIELDS="course_modules" COMMENT="Foreign key on course modules table."/>
<KEY NAME="cmidkey" TYPE="foreign" FIELDS="cmid" REFTABLE="course_modules" REFFIELDS="id" COMMENT="Foreign key on course modules table."/>
<KEY NAME="competencyidkey" TYPE="foreign" FIELDS="competencyid" REFTABLE="tool_lp_competency" REFFIELDS="id" COMMENT="Foreign key on competency id."/>
</KEYS>
<INDEXES>
@@ -339,4 +336,4 @@
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
+1 -3
View File
@@ -847,9 +847,7 @@ function xmldb_tool_lp_upgrade($oldversion) {
// Adding keys to table tool_lp_coursecompsettings.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// Adding indexes to table tool_lp_coursecompsettings.
$table->add_index('courseiduniq', XMLDB_INDEX_UNIQUE, array('courseid'));
$table->add_key('courseidlink', XMLDB_KEY_FOREIGN_UNIQUE, array('courseid'), 'course', array('id'));
// Conditionally launch create table for tool_lp_coursecompsettings.
if (!$dbman->table_exists($table)) {