mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
merged fix for MDL-11909, putting a unique constraint userid-itemid on grade_grades table
This commit is contained in:
parent
2eb467b3b5
commit
1dda50ea08
3 changed files with 18 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<XMLDB PATH="lib/db" VERSION="20071010" COMMENT="XMLDB file for core Moodle tables"
|
<XMLDB PATH="lib/db" VERSION="20071108" COMMENT="XMLDB file for core Moodle tables"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||||
>
|
>
|
||||||
|
@ -1301,7 +1301,8 @@
|
||||||
<KEY NAME="itemid" TYPE="foreign" FIELDS="itemid" REFTABLE="grade_items" REFFIELDS="id" PREVIOUS="primary" NEXT="userid"/>
|
<KEY NAME="itemid" TYPE="foreign" FIELDS="itemid" REFTABLE="grade_items" REFFIELDS="id" PREVIOUS="primary" NEXT="userid"/>
|
||||||
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" PREVIOUS="itemid" NEXT="rawscaleid"/>
|
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" PREVIOUS="itemid" NEXT="rawscaleid"/>
|
||||||
<KEY NAME="rawscaleid" TYPE="foreign" FIELDS="rawscaleid" REFTABLE="scale" REFFIELDS="id" PREVIOUS="userid" NEXT="usermodified"/>
|
<KEY NAME="rawscaleid" TYPE="foreign" FIELDS="rawscaleid" REFTABLE="scale" REFFIELDS="id" PREVIOUS="userid" NEXT="usermodified"/>
|
||||||
<KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id" PREVIOUS="rawscaleid"/>
|
<KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id" PREVIOUS="rawscaleid" NEXT="userid-itemid"/>
|
||||||
|
<KEY NAME="userid-itemid" TYPE="unique" FIELDS="userid, itemid" COMMENT="one entry per user per item" PREVIOUS="usermodified"/>
|
||||||
</KEYS>
|
</KEYS>
|
||||||
<INDEXES>
|
<INDEXES>
|
||||||
<INDEX NAME="locked-locktime" UNIQUE="false" FIELDS="locked, locktime" COMMENT="used in grading cron"/>
|
<INDEX NAME="locked-locktime" UNIQUE="false" FIELDS="locked, locktime" COMMENT="used in grading cron"/>
|
||||||
|
|
|
@ -2583,6 +2583,20 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||||
// Could not create the readme file. No cause for huge concern
|
// Could not create the readme file. No cause for huge concern
|
||||||
notify("Could not create the README.txt file in $readmefilename.");
|
notify("Could not create the README.txt file in $readmefilename.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result && $oldversion < 2007101502) {
|
||||||
|
|
||||||
|
/// Define key userid-itemid (unique) to be added to grade_grades
|
||||||
|
$table = new XMLDBTable('grade_grades');
|
||||||
|
$key = new XMLDBKey('userid-itemid');
|
||||||
|
$key->setAttributes(XMLDB_KEY_UNIQUE, array('userid', 'itemid'));
|
||||||
|
|
||||||
|
/// Launch add key userid-itemid
|
||||||
|
$result = $result && add_key($table, $key);
|
||||||
|
|
||||||
|
/// Main savepoint reached
|
||||||
|
upgrade_main_savepoint($result, 2007101502);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// This is compared against the values stored in the database to determine
|
// This is compared against the values stored in the database to determine
|
||||||
// whether upgrades should be performed (see lib/db/*.php)
|
// whether upgrades should be performed (see lib/db/*.php)
|
||||||
|
|
||||||
$version = 2007101501; // YYYYMMDD = date
|
$version = 2007101502; // YYYYMMDD = date
|
||||||
// XY = increments within a single day
|
// XY = increments within a single day
|
||||||
|
|
||||||
$release = '2.0 dev'; // Human-friendly version name
|
$release = '2.0 dev'; // Human-friendly version name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue